Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: LayoutTests/editing/selection/selection-change-in-mutation-event-by-remove-children.html

Issue 25389004: Notify nodes removal to Range/Selection after dispatching blur and mutation event (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2013-10-07T14:24:36 Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/editing/selection/selection-change-in-mutation-event-by-remove-children.html
diff --git a/LayoutTests/editing/selection/selection-change-in-mutation-event-by-remove-children.html b/LayoutTests/editing/selection/selection-change-in-mutation-event-by-remove-children.html
new file mode 100644
index 0000000000000000000000000000000000000000..1d654ba1a9c894c20239ebeeb0dcc31eb966abd1
--- /dev/null
+++ b/LayoutTests/editing/selection/selection-change-in-mutation-event-by-remove-children.html
@@ -0,0 +1,26 @@
+<div id="container">
+<p id="description"></p>
+<div id="sample">foobar</div>
+</div>
+<div id="console"></div>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script>
+description('Selection should be updated after set innerHTML.');
+
+function $(id) { return document.getElementById(id); }
+
+var selection = window.getSelection();
+document.addEventListener('DOMNodeRemovedFromDocument', function () {
+ selection.selectAllChildren($('sample'));
+}, true);
+
+selection.selectAllChildren($('sample'));
+$('sample').innerHTML = '';
+
+shouldBe('selection.anchorOffset', '0');
+shouldBe('selection.focusOffset', '0');
+
+if (window.testRunner)
+ $('container').outerHTML = '';
+</script>
+<script src="../../fast/js/resources/js-test-post.js"></script>

Powered by Google App Engine
This is Rietveld 408576698