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 16435 - 'this' value in MutationObserver callback should be MutationObserver object by default
Summary: 'this' value in MutationObserver callback should be MutationObserver object b...
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-03-19 15:37 UTC by Olli Pettay
Modified: 2012-03-19 16:00 UTC (History)
2 users (show)

See Also:


Attachments

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.