分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 前端开发

JS-监听整个页面上的DOM树变化

发布时间:2023-09-06 02:28责任编辑:赖小花关键词:DOM
# [在线预览](https://jsfiddle.net/1010543618/fyf913t0/)## 方法- 使用《Web API 接口》的《MutationObserver》[MutationObserver](https://developer.mozilla.org/zh-CN/docs/Web/API/MutationObserver)网上查到的很多都是使用Mutation events的,但在MDN上一查这个事件已经废弃了,并且推荐用MutationObserver替换掉> DeprecatedThis feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time. > Mutation events provide a mechanism for a web page or an extension to get notified about changes made to the DOM. Use Mutation Observers instead if possible.```html ?????

下述方法也可以监听使用《谷歌页面翻译》时的DOM变化

?

The following way also can catch changes of DOM when using Google page translation

?

使用MutationObserver(Using MutationObserver)

?
Hello Mr. Word!
? ?```

JS-监听整个页面上的DOM树变化

原文地址:https://www.cnblogs.com/jffun-blog/p/10206588.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved