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

See Also:


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) {}
(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.