admin 管理员组文章数量: 1086019
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.
本文标签:
版权声明:本文标题:javascript - How do I find out what causes jQuery-related message of "Use of Mutation Events is deprecated. Use Mutatio 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1744012846a2518472.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论