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

Side by Side Diff: LayoutTests/editing/selection/range-surroundContents-with-preceding-node.html

Issue 25571006: Fix out-of-date offset in selection range code. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Better test. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/editing/selection/range-surroundContents-with-preceding-node-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <body> 3 <body>
4 <script src="../../fast/js/resources/js-test-pre.js"></script> 4 <script src="../../fast/js/resources/js-test-pre.js"></script>
5 <script>
6 window.onload = function(){
7 var range = document.createRange();
8 var rootNode = document.getElementById("root");
9 range.setStart(rootNode, 4);
10 range.setEnd(rootNode, 6);
11 var parentElement = document.getElementById("targetForSurround");
12 range.surroundContents(parentElement);
13
14 shouldBe(range.startContainer.id, rootNode.id);
15 shouldBe(range.startOffset.toString(), "3");
16 shouldBe(range.endContainer.id, rootNode.id);
17 shouldBe(range.startOffset.toString(), "3");
18 };
19 </script>
20 <script src="../../fast/js/resources/js-test-post.js"></script>
21 <div id="root"> 5 <div id="root">
22 <div id="targetForSurround"></div> 6 <div id="targetForSurround"></div>
23 <div id="description">Test that there is no crash when surroundContents is called with a node preceding the current selection.</div> 7 <div id="description">Test that there is no crash when surroundContents is called with a node preceding the current selection.</div>
24 <div id="trailingNode"></div> 8 <div id="trailingNode"></div>
25 </div> 9 </div>
10 <script>
11 var range = document.createRange();
12 var rootNode = document.getElementById("root");
13 range.setStart(rootNode, 4);
14 range.setEnd(rootNode, 6);
15 var parentElement = document.getElementById("targetForSurround");
16 range.surroundContents(parentElement);
17
18 shouldBe('range.startContainer.id', 'rootNode.id');
19 shouldBe('range.startOffset', '3');
20 shouldBe('range.endContainer.id', 'rootNode.id');
21 shouldBe('range.startOffset', '3');
22 </script>
23 <script src="../../fast/js/resources/js-test-post.js"></script>
26 </body> 24 </body>
27 </html> 25 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/editing/selection/range-surroundContents-with-preceding-node-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698