Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/389.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Firefox不遵守Observer中的childList配置参数_Javascript_Html_Mutation Observers - Fatal编程技术网

Javascript Firefox不遵守Observer中的childList配置参数

Javascript Firefox不遵守Observer中的childList配置参数,javascript,html,mutation-observers,Javascript,Html,Mutation Observers,以下是我如何声明我的突变观察者: observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { switch (mutation.type) { case 'childList': // Do Stuff break; } }) observer

以下是我如何声明我的突变观察者:

observer = new MutationObserver(function(mutations) {
    mutations.forEach(function(mutation) {
        switch (mutation.type) {
            case 'childList':
                // Do Stuff
            break;
        }
    })

observer.observe(
    document.getElementById('contentEditableElement'), 
    {
        attributes: false, 
        childList: true, 
        characterData: false
    }
);
上面的代码在Chrome中完全可以正常工作。当我将HTML元素拖放到“内容可编辑”区域时,当元素直接拖放到观察到的元素上时,以及当元素拖放到观察到的元素的子元素中时,观察者都会触发

在FireFox(V29.0.1)中,观察者仅在元素直接添加到观察到的元素而不是其子元素时才会触发。为什么?

你忘了把

subtree: true
应该是

document.getElementById('contentEditableElement'), 
    {
        attributes: false, 
        childList: true, 
        characterData: false,
        subtree: true
    }

将属性和characterData设置为true时会发生什么情况?您的代码与moz示例非常相似:行为没有变化。