[Bug 27320] Need some clarification around MutationObserver stuff.

https://www.w3.org/Bugs/Public/show_bug.cgi?id=27320

Olli Pettay <bugs@pettay.fi> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugs@pettay.fi
         Resolution|---                         |INVALID

--- Comment #1 from Olli Pettay <bugs@pettay.fi> ---
(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 the QA Contact for the bug.

Received on Thursday, 13 November 2014 21:22:15 UTC