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;
var self = this;
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.initChildrenObserver();
},
onChildListModified : function BrowserUIShowHideObserver_onChildListModified(aMutations, aObserver)
onMutationOnParent : function BrowserUIShowHideObserver_onMutationOnParent(aMutations, aObserver)
{
aMutations.forEach(function(aMutation) {
if (aMutation.type != 'childList')
return;
this.destroyChildrenObserver();
this.initChildrenObserver();
switch (aMutation.type)
{
case 'childList':
this.destroyChildrenObserver();
this.initChildrenObserver();
return;
case 'attributes':
this.onAttributeModified(this.box, aMutations, aObserver);
return;
}
}, this);
},