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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/selection/unrendered-001.html

Issue 2697313005: Selection API: collapse() should recreate an internal Range. (Closed)
Patch Set: Add NeedsRebaseline for platform-dependent tests Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script> 2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script> 3 <script src="../../resources/testharnessreport.js"></script>
4 <div contenteditable id="root" class="editing"> 4 <div contenteditable id="root" class="editing">
5 <span id="sample">foo</span><span id="start" style="display: none;">bar</span> b az 5 <span id="sample">foo</span><span id="start" style="display: none;">bar</span> b az
6 </div> 6 </div>
7 <div id="log"></div> 7 <div id="log"></div>
8 <script> 8 <script>
9 test(function() { 9 test(function() {
10 var selection = window.getSelection(); 10 var selection = window.getSelection();
11 var sample = document.getElementById('sample'); 11 var sample = document.getElementById('sample');
12 12
13 selection.collapse(document.getElementById('start').firstChild, 2); 13 selection.collapse(document.getElementById('start').firstChild, 2);
14 14
15 assert_true(selection.isCollapsed, 'isCollapsed'); 15 assert_true(selection.isCollapsed, 'isCollapsed');
16 assert_equals(selection.anchorNode, sample.lastChild, 'anchorNode'); 16 assert_equals(selection.anchorNode, document.getElementById('start').firstCh ild, 'DOM anchorNode');
17 assert_equals(selection.anchorOffset, 3, 'anchorOffset'); 17 assert_equals(selection.anchorOffset, 2, 'DOM anchorOffset');
18 assert_exists(window, 'internals');
19 assert_equals(internals.visibleSelectionAnchorNode, sample.lastChild, 'Canon icalized anchorNode');
20 assert_equals(internals.visibleSelectionAnchorOffset, 3, 'Canoincalized anch orOffset');
18 }); 21 });
19 </script> 22 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698