work around chrome and mutation observer bug. fixes #1099
This commit is contained in:
parent
53fff96c29
commit
78139a80ba
13
select2.js
13
select2.js
@ -961,12 +961,19 @@ the specific language governing permissions and limitations under the Apache Lic
|
|||||||
|
|
||||||
// mozilla and IE
|
// mozilla and IE
|
||||||
el.bind("propertychange.select2 DOMAttrModified.select2", sync);
|
el.bind("propertychange.select2 DOMAttrModified.select2", sync);
|
||||||
|
|
||||||
|
|
||||||
|
// hold onto a reference of the callback to work around a chromium bug
|
||||||
|
if (this.mutationCallback === undefined) {
|
||||||
|
this.mutationCallback = function (mutations) {
|
||||||
|
mutations.forEach(sync);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// safari and chrome
|
// safari and chrome
|
||||||
if (typeof WebKitMutationObserver !== "undefined") {
|
if (typeof WebKitMutationObserver !== "undefined") {
|
||||||
if (this.propertyObserver) { delete this.propertyObserver; this.propertyObserver = null; }
|
if (this.propertyObserver) { delete this.propertyObserver; this.propertyObserver = null; }
|
||||||
this.propertyObserver = new WebKitMutationObserver(function (mutations) {
|
this.propertyObserver = new WebKitMutationObserver(this.mutationCallback);
|
||||||
mutations.forEach(sync);
|
|
||||||
});
|
|
||||||
this.propertyObserver.observe(el.get(0), { attributes:true, subtree:false });
|
this.propertyObserver.observe(el.get(0), { attributes:true, subtree:false });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user