mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
LibWeb: Make DOM Nodes keep their Document alive
In addition to being reference-counted, all nodes that are part of a document must also keep the document alive. This is achieved by adding a second ref-count to the Document object and incrementing/decrementing it whenever a node is created/destroyed in that document. This brings us much closer to a proper DOM lifetime model, although the JS bindings still need more work.
This commit is contained in:
parent
99acbbe86b
commit
f68ed6d25b
5 changed files with 45 additions and 11 deletions
|
@ -65,6 +65,8 @@ public:
|
|||
|
||||
virtual ~Node();
|
||||
|
||||
void removed_last_ref();
|
||||
|
||||
NodeType type() const { return m_type; }
|
||||
bool is_element() const { return type() == NodeType::ELEMENT_NODE; }
|
||||
bool is_text() const { return type() == NodeType::TEXT_NODE; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue