Observe changes of attributes of the parent box itself correctly

This commit is contained in:
YUKI Hiroshi 2013-09-13 19:44:48 +09:00
parent bbe6b79024
commit 443356caa1

View File

@ -53,18 +53,25 @@ BrowserUIShowHideObserver.prototype = {
return; return;
var self = this; var self = this;
this.observer = new this.MutationObserver(function(aMutations, aObserver) { this.observer = new this.MutationObserver(function(aMutations, aObserver) {
self.onChildListModified(aMutations, aObserver); self.onMutationOnParent(aMutations, aObserver);
}); });
this.observer.observe(this.box, { childList : true, attributes : true }); this.observer.observe(this.box, { childList : true, attributes : true });
this.initChildrenObserver(); this.initChildrenObserver();
}, },
onChildListModified : function BrowserUIShowHideObserver_onChildListModified(aMutations, aObserver) onMutationOnParent : function BrowserUIShowHideObserver_onMutationOnParent(aMutations, aObserver)
{ {
aMutations.forEach(function(aMutation) { aMutations.forEach(function(aMutation) {
if (aMutation.type != 'childList') switch (aMutation.type)
return; {
this.destroyChildrenObserver(); case 'childList':
this.initChildrenObserver(); this.destroyChildrenObserver();
this.initChildrenObserver();
return;
case 'attributes':
this.onAttributeModified(this.box, aMutations, aObserver);
return;
}
}, this); }, this);
}, },