mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Add dummy MutationObserver shim for older browsers
This commit is contained in:
parent
64c37ccd1d
commit
bccf3d68e2
1 changed files with 11 additions and 6 deletions
|
|
@ -418,13 +418,18 @@ var messager = vAPI.messaging.channel('contentscript-end.js');
|
|||
}
|
||||
|
||||
if (!window.MutationObserver) {
|
||||
// DOMSubtreeModified?
|
||||
if (!window.WebKitMutationObserver) {
|
||||
return;
|
||||
}
|
||||
window.MutationObserver = window.WebKitMutationObserver || window.MozMutationObserver;
|
||||
|
||||
// Safari
|
||||
window.MutationObserver = window.WebKitMutationObserver;
|
||||
// dummy shim for older browsers
|
||||
if (!window.MutationObserver) {
|
||||
window.MutationObserver = function(handler) {
|
||||
this.observe = function(target) {
|
||||
target.addEventListener('DOMNodeInserted', function(e) {
|
||||
handler([{addedNodes: [e.target]}]);
|
||||
}, true);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var ignoreTags = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue