[Bug 27320] Need some clarification around MutationObserver stuff.

[email protected]
Newsgroups gmane.comp.web.dom.general
Message-ID <[email protected]/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=27320

Olli Pettay <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |[email protected]
         Resolution|---                         |INVALID

--- Comment #1 from Olli Pettay <[email protected]> ---
(In reply to Arkadiusz Michalski (Spirit) from comment #0)
> I tried analyze dependencies across all algorithms and other prose for
> MutationObserver oposite to how browsers works, but every time something is
> wrong. Here are some inaccuracies:
> 
> === 
> 
> callback MutationCallback = void (sequence<MutationRecord> mutations,
> MutationObserver observer);
> 
> In practice mutations and observer are optional (Firefox/Chrome/IE), so
> maybe add "optional" to IDL? And maybe cover this somehow in prose (step 3.4
> in "notify mutation observers").

No need for optional there. That is just how callbacks work. 
Similar to event listeners.
callback interface EventListener {
  void handleEvent(Event event);
};
yet you don't have to define the parameter if you're not going to use it
anywhere.


> Per spec. callback get only copy of MO (as second argument) but all browsers
> operate on original.
Nothing says observer should be copy.
In fact, there is the following as a note:
"the constructed MutationObserver object as second argument. "
and there is also
"If queue is non-empty, call mo's callback with queue as first argument, and mo
(itself) as second argument and callback this value. "


> 
> 	var new_MO = new MutationObserver(function(records, observer){
> 
> 		// All browsers trate new_MO and observer as the same object (instance)
> and clear its record queue before invoke callback
> 		// its correct per step 3.2, but in generaly not per step 2. (algo "notify
> mutation observers") because its operate on copy
Step 2 says to take a copy of the list. Not copy the MutationObserver objects.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.