我有一个DIV
with 样式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 中它运行良好。
这种行为是有意的和/或标准的吗?它是一个错误吗?