4 ms·
In a DOM tree, any live node in the tree needs to keep the entire tree alive. Which means you either need some sort of garbage collection setup, or reference c
by bzbarsky 8y ago
In a DOM tree, any live node in the tree needs to keep the entire tree alive.
Which means you either need some sort of garbage collection setup, or reference counting (with cycle collection), or some sort of indirection where you really hold references to a "tree + node" pair and then have to worry about what happens when a node moves from one tree to another. Or something else, other than just having a bunch of objects that all point to each other without any explicit ownership semantics...