6

我有一个DIVwith 样式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 中它运行良好。

这种行为是有意的和/或标准的吗?它是一个错误吗?

4

1 回答 1

7

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

于 2013-11-30T00:15:02.223 回答