简体   繁体   English

我如何使用mutationobserver而不是突变事件?

[英]How do I use mutationobserver instead of mutation events?

I am trying to create my first streamgraph with D3.js. 我正在尝试用D3.js创建我的第一个流程图。 I am starting with a working example which incorporates a tooltip from code posted on-line, http://bl.ocks.org/WillTurman/4631136 : 我从一个工作示例开始,该示例包含来自在线发布的代码的工具提示, http//bl.ocks.org/WillTurman/4631136

在此输入图像描述

When I copy the index.html and data.csv files to my PC (Windows 7), I am able to see the streamgraph in a browser (Firefox). 当我将index.htmldata.csv文件复制到我的PC(Windows 7)时,我能够在浏览器(Firefox)中看到流图。 However, I get a JS warning, " Use of Mutation Events is deprecated. Use MutationObserver instead. " 但是,我得到一个JS警告,“ 不推荐使用Mutation事件。请改用MutationObserver。

What lines of code correspond to the Mutation Event? 哪些代码行对应于Mutation事件? And how should I edit them to use a MutationObserver instead? 我应该如何编辑它们以使用MutationObserver呢?

I am new to D3 and javascript. 我是D3和javascript的新手。 Although I found some discussion of mutation events and MutationObservers on-line, I didn't see any examples that were basic enough for me to understand and apply to my situation. 虽然我发现了一些关于突变事件和MutationObservers的在线讨论,但我没有看到任何基本的例子让我理解并适用于我的情况。 I would appreciate any tips. 我会很感激任何提示。

This is something that will need to be changed in the D3 source. 这是需要在D3源中更改的内容。 As a user (and certainly as a beginner), you don't need to worry about this -- the warning is only relevant to the developers. 作为用户(当然还是初学者),您无需担心这一点 - 警告仅与开发人员相关。 Feel free to open an issue about this. 随意打开一个关于此的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM