This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 16638 - Define who owns what with MutationObserver
Summary: Define who owns what with MutationObserver
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: DOM (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Anne
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-05 06:33 UTC by Olli Pettay
Modified: 2012-11-09 18:59 UTC (History)
6 users (show)

See Also:


Attachments

Description Olli Pettay 2012-04-05 06:33:22 UTC
Should MutationObserver own the nodes it is observing?
I think not. If JS doesn't have a pointer to the node, it can't
modify it.
But if the original observe target is deleted, what should happen
to the transient observers? I think they should still work (until the end of
the microtask). That way GC/CC behavior isn't visible to the API user.

Then MutationObserver object itself... I think the only way to hide GC/CC
behavior is to keep MutationObserver object alive as long as
the node(s) it is observing is/are alive.
Comment 1 Ryosuke Niwa 2012-04-05 06:37:45 UTC
Yes, that makes sense.
Comment 2 Anne 2012-04-05 16:46:08 UTC
So MutationObserver has weak references to its nodes?
Comment 3 Olli Pettay 2012-04-06 08:07:54 UTC
Yes, and nodes have strong references to the MutationObservers which are
observing them
Comment 4 Anne 2012-11-09 15:10:49 UTC
Is http://dom.spec.whatwg.org/#garbage-collection correct?
Comment 6 Adam Klein 2012-11-09 15:13:19 UTC
Sounds right to me
Comment 7 Olli Pettay 2012-11-09 18:59:57 UTC
Yup, looks ok.