Bug 16435 - 'this' value in MutationObserver callback should be MutationObserver object by default
'this' value in MutationObserver callback should be MutationObserver object b...
Status: RESOLVED FIXED
Product: WebAppsWG
Classification: Unclassified
Component: DOM
unspecified
PC Linux
: P2 normal
: ---
Assigned To: Anne
public-webapps-bugzilla
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-19 15:37 UTC by Olli Pettay
Modified: 2012-03-19 16:00 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olli Pettay 2012-03-19 15:37:35 UTC
This behavior was agreed long ago.
The reason to have separate parameter for MutationObserver was to
be able to access the observer in the following cases
{
  handleMutations: function(r, m) {}
}
and
(function(r, m) {}).bind(foo);

I'm not quite sure what DOM4 says about this case, it is pretty vague atm.
Comment 1 Anne 2012-03-19 15:54:54 UTC
We no longer have the handleMutations thing. Do we still need the second parameter?
Comment 2 Anne 2012-03-19 15:55:14 UTC
Oops, sorry about that. I did define the callback this value already: https://bitbucket.org/ms2ger/dom-core/changeset/865576f86f20
Comment 3 Olli Pettay 2012-03-19 15:57:20 UTC
The 2nd parameter is useful for the fn.bind() case, like
event.currentTarget is useful with fn.bind()
Comment 4 Anne 2012-03-19 16:00:17 UTC
Good point. Then this is indeed fixed.