google-chrome - 我应该使用MutationRecord.oldValue吗?

标签 google-chrome dom webkit mutation-observers

我正在Windows 7上使用最新的Google Chrome稳定版(19.0.1084.56 m),并首次尝试使用Mutation观察器。 (该项目是第三方网站的用户脚本,我无法访问其服务器。)

碰巧 MutationRecord 有一个字段oldValue:

record . oldValue

The return value depends on type. For "attributes", it is the value of the changed attribute before the change. For "characterData", it is the data of the changed node before the change. For "childList", it is null.



因此,我正在监视characterData的更改,但是当我获取MutationRecord时,oldValue字段始终为null。

它应该可以工作吗,是否有可能我出了点问题,或者此功能太先进了以至于无法正常工作?

在哪里可以找到Google的文档,错误报告,功能请求等内容,这些内容可以声明是否已实现或何时实现?

最佳答案

使用以下方式配置观察者:

observer.observe(container, {
    attributeOldValue : true
});

完整的API文档:
https://developer.mozilla.org/pt-BR/docs/Web/API/MutationObserver

关于google-chrome - 我应该使用MutationRecord.oldValue吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11290007/

相关文章:

html - 如何从打印页面 (Chrome) 中删除 url(显示在链接后)?

javascript - 防止 "jQuery( html )"触发浏览器请求图片等引用内容

jquery - 使用 Jquery 删除文本

javascript - 是否有针对 HTML 的 "object"标记的跨浏览器标准加载事件?

javascript - Webkit 和 C# 修复脚本

internet-explorer - 我们应该为我们的 Intranet 应用程序部署 Webkit 浏览器吗?

webkit - 为什么 mozilla 和 webkit 将 -moz- 和 -webkit- 添加到 CSS3 规则之前?

javascript - Google Chrome 扩展程序中的自动对焦

javascript - 在 chrome 和 safari 中附加 onload 事件时 window.open 不起作用

windows - 使用网络面板进行分析时,强制 Chrome 关闭/重新打开所有 TCP/TLS 连接