- From: <bugzilla@jessica.w3.org>
- Date: Thu, 12 Sep 2013 19:59:36 +0000
- To: public-webapps-bugzilla@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=23226 --- Comment #4 from Bradley Meck <bradley.meck@gmail.com> --- (In reply to Rafael Weinstein from comment #3) > Object.observe seems like the right solution for this problem. > > http://wiki.ecmascript.org/doku.php?id=harmony:observe > > It already has exactly this mechanism, e.g. > Object.getNotifier(node).notify({ type: "myCustomChangeRecordType", data: > ..., otherData: ... }); > > This mechanism already has built into it a notion of observers 'accepting' a > specific set of change record types, so that observing code isn't at risk of > breaking if observed nodes suddenly update to emit new change record types. Object.observe poses some problems we should look at with relation to notification creation / subtree observation: * It would need a way to propagate up the DOM subtree * we iterate up node.parentNode if we add observers / notifiers to all Nodes and chaining appropriately * The properties that make up the base case for this are getter/setters which are not covered using Object.observe / getNotifier [1][2][3] * We can work around this by adding node.notify(...) to the getter / setter algorithms * These notifications would be propagated to MutationObservers The key problem for me with using *only* Object.observe is the disconnect of purposes. MutationObservers is a means of monitoring the state of a DOM subtree. Object.observe does not have the concept of a tree structure. For subtree observation present in MutationObservers it would be very odd to deal with during Object.observe because other notification callbacks could change the DOM tree while notifications are being passed down the tree to an observer of a DOM subtree. We could cache the list of parentNodes on first notification, but only if we can reliably cause the notification to create this cache before any DOM mutation occurs again. [1] http://www.w3.org/TR/WebIDL/#es-attributes [2] http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#the-input-element [3] https://code.google.com/p/chromium/issues/detail?id=260881#c6 -- You are receiving this mail because: You are the QA Contact for the bug.
Received on Thursday, 12 September 2013 19:59:38 UTC