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

ε祈祈猫儿з 提交于 2019-11-28 04:37:27

问题


I have a DIV with style resize: both and then I set a MutationObserver that listens for changes in attributes.

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

I made a fiddle: http://jsfiddle.net/2NQQu/2/

In Chrome (I tested Chrome 31) the callback is not fired when you resize the DIV with the mouse. In Firefox it works fine.

Is this behavior intentional and/or standard? Is it a bug?


回答1:


It is a bug in Chrome, reported here. The bug is still open, which means it has not been fixed.



来源:https://stackoverflow.com/questions/20294828/manually-resizing-an-element-doesnt-fire-a-mutation-observer-in-chrome

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!