【问题标题】:Manually resizing an element doesn't fire a mutation observer in Chrome手动调整元素大小不会触发 Chrome 中的突变观察者
【发布时间】:2013-11-29 23:47:06
【问题描述】:

我有一个DIV 样式为resize: both,然后我设置了一个MutationObserver 来监听属性的变化。

mutObs = new MutationObserver(function () {
    console.log('Hello');
});

elem = document.getElementById('aDiv');
mutObs.observe(elem, {
    attributes: true
});

elem.style.width = '300px'; //this fires the observer callback as expected

我做了一个小提琴:http://jsfiddle.net/2NQQu/2/

在 Chrome(我测试了 Chrome 31)中,当您使用鼠标调整 DIV 的大小时,不会触发回调。在 Firefox 中它工作正常。

这种行为是有意的和/或标准的吗?是bug吗?

【问题讨论】:

  • 现在已修复。

标签: javascript html google-chrome resize mutation-observers


【解决方案1】:

这是 Chrome 中的一个错误,reported here。该错误仍然存​​在,这意味着它尚未修复。

【讨论】:

  • 2013 年 9 月 20 日首次作为错误报告,目前仍是未解决的问题。
猜你喜欢
  • 2020-03-23
  • 1970-01-01
  • 2021-09-23
  • 2021-07-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-03-11
相关资源
最近更新 更多