手动调整元素大小;不要在Chrome中激发突变观察者

Manually resizing an element doesn't fire a mutation observer in Chrome

本文关键字:Chrome 观察者 突变 调整 元素      更新时间:2023-12-13

我有一个样式为resize: bothDIV,然后我设置了一个侦听属性更改的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中,它运行良好。

这种行为是故意的和/或标准的吗?是虫子吗?

这里报告了Chrome中的一个错误。该错误仍然处于打开状态,这意味着它尚未修复。