Node.replaceChild with an empty DocumentFragment should not dispatch DOMSubtreeModified twice |
||
Issue description
Version: 55 canary
OS: all
What steps will reproduce the problem?
(1) Load the following document:
<!DOCTYPE html>
<div id="target"><span id="next"></span></div>
<script>
var target = document.getElementById('target');
var next = document.getElementById('next')
target.addEventListener('DOMSubtreeModified', function() {
console.log('DOMSubtreeModified');
}, false);
target.addEventListener('DOMNodeRemoved', function() {
console.log('DOMNodeRemoved');
}, false);
var fragment = document.createDocumentFragment();
target.replaceChild(fragment, next);
</script>
(2) Observe the DevTools console
What is the expected output?
DOMNodeRemoved
DOMSubtreeModified
What do you see instead?
DOMNodeRemoved
2 DOMSubtreeModified
Please use labels and text to provide additional information.
Edge and Firefox have the expected output.
,
Sep 12 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/8f99074d5ad2b2ef95d3192b37884dc434e71ff3 commit 8f99074d5ad2b2ef95d3192b37884dc434e71ff3 Author: tkent <tkent@chromium.org> Date: Mon Sep 12 05:41:01 2016 Node.replaceChild with an empty DocumentFragment should not dispatch DOMSubtreeModified twice. We should check the emptiness. The new behavior matches to Firefox and Edge. * LayoutTests/fast/loader/delete-inside-cancelTimer.html The replaceChild behavior change affects the output of the test. This CL doesn't update the result and removes the test entirely because - It's a crash test for CachedResource. [1] - Now the class is on Oilpan heap, and the test isn't helpful at all. [1] https://chromium.googlesource.com/chromium/src/+/5e8f72d1c3a42b5ab0c727f52c24009b36721255 BUG= 645441 Review-Url: https://codereview.chromium.org/2325143002 Cr-Commit-Position: refs/heads/master@{#417871} [add] https://crrev.com/8f99074d5ad2b2ef95d3192b37884dc434e71ff3/third_party/WebKit/LayoutTests/fast/dom/replaceChild-domsubtreemodified.html [delete] https://crrev.com/c23b2a5192ee77dd842b3e79575d586743364b32/third_party/WebKit/LayoutTests/fast/loader/delete-inside-cancelTimer-expected.txt [delete] https://crrev.com/c23b2a5192ee77dd842b3e79575d586743364b32/third_party/WebKit/LayoutTests/fast/loader/delete-inside-cancelTimer.html [modify] https://crrev.com/8f99074d5ad2b2ef95d3192b37884dc434e71ff3/third_party/WebKit/Source/core/dom/ContainerNode.cpp
,
Sep 13 2016
|
||
►
Sign in to add a comment |
||
Comment 1 Deleted