I get this message when loading a typical page on my browser:
Use of Mutation Events is deprecated. Use MutationObserver instead.
Line Number where this message happens to be thrown is given as: jquery-3.2.1.js:5062:6
Looking at jQuery source, this is the code it contains, where the offending line is elem.addEventListener( type, eventHandle );
// Init the event handler queue if we're the first
if ( !( handlers = events[ type ] ) ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener if the special events handler returns false
if ( !special.setup ||
special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle );
# ^^^^^ the line that throws the Mutation Observer message
}
}
}
How do I find out the code responsible for triggering this message?
I get this message when loading a typical page on my browser:
Use of Mutation Events is deprecated. Use MutationObserver instead.
Line Number where this message happens to be thrown is given as: jquery-3.2.1.js:5062:6
Looking at jQuery source, this is the code it contains, where the offending line is elem.addEventListener( type, eventHandle );
// Init the event handler queue if we're the first
if ( !( handlers = events[ type ] ) ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener if the special events handler returns false
if ( !special.setup ||
special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle );
# ^^^^^ the line that throws the Mutation Observer message
}
}
}
How do I find out the code responsible for triggering this message?
Share Improve this question edited Jul 25, 2018 at 20:45 Dennis asked May 18, 2017 at 13:36 DennisDennis 8,12112 gold badges73 silver badges121 bronze badges 4- It's likely due to a third-party library using the deprecated events. See stackoverflow./q/19965211/215552, stackoverflow./q/18223315/215552, many others. I just searched on that error message and found those two. – Heretic Monkey Commented May 18, 2017 at 14:03
- The error says your code uses obsolete DOM mutation events. – woxxom Commented May 19, 2017 at 2:42
- 1 This seems like deja vu... Do a search of your code base (and those of the plugins you're using, etc.) looking for a mutation event name (e.g., "DOMAttrModified"). – Heretic Monkey Commented Jul 25, 2018 at 20:50
-
I found the offending line. Goes something like this:
$('#main').on('DOMNodeInserted', function() {load_ui_globals();});
– Dennis Commented Jul 25, 2018 at 20:58
1 Answer
Reset to default 5Per ments under the question:
Search your codebase for the deprecated DOM events, i.e the regex of:
DOMAttrModified|DOMAttributeNameChanged|DOMCharacterDataModified|DOMElementNameChanged|DOMNodeInserted|DOMNodeInsertedIntoDocument|DOMNodeRemoved|DOMNodeRemovedFromDocument|DOMSubtreeModified
It will show you offending lines that trigger deprecated events.