Skip to content
Permalink
Browse files

Fix MutationObserver usage

We can't use object with "handleMutations" method as callback since Firefox 20.0a1 (2012-12-19)
https://bugzilla.mozilla.org/show_bug.cgi?id=790978
  • Loading branch information...
Infocatcher committed Dec 19, 2012
1 parent e49f47a commit bda47e5f0c1c3704938c28987b78ca670474174f
Showing with 13 additions and 3 deletions.
  1. +5 −1 Attributes_Inspector/attrsInspector.js
  2. +5 −1 Extensions_Developer_Tools/extDevTools.js
  3. +3 −1 Title_Bar/titleBar.js
@@ -619,9 +619,13 @@ function init() {
},

get mutationObserver() {
var _this = this;
function callback() {
_this.handleMutations.apply(_this, arguments);
}
delete this.mutationObserver;
return this.mutationObserver = "MutationObserver" in this.window // Firefox 14+
&& new this.window.MutationObserver(this);
&& new this.window.MutationObserver(callback);
},
watchAttrs: function(node) {
this.unwatchAttrs(); // Only one watched node
@@ -1591,9 +1591,13 @@ function init() {
},

get mutationObserver() {
var _this = this;
function callback() {
_this.handleMutations.apply(_this, arguments);
}
delete this.mutationObserver;
return this.mutationObserver = "MutationObserver" in this.window // Firefox 14+
&& new this.window.MutationObserver(this);
&& new this.window.MutationObserver(callback);
},
watchAttrs: function(node) {
this.unwatchAttrs(); // Only one watched node
@@ -55,7 +55,9 @@ var titleUpdater = {
}
};
if("MutationObserver" in window) {
var mo = new MutationObserver(titleUpdater);
var mo = new MutationObserver(function() {
titleUpdater.handleMutations.apply(titleUpdater, arguments);
});
// http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#mutation-observers
mo.observe(root, {
attributes: true,

0 comments on commit bda47e5

Please sign in to comment.
You can’t perform that action at this time.