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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/StaticRange/staticrange-no-mutate.html

Issue 2022863002: [InputEvent] Introduce |StaticRange| and use in |InputEvent::getRanges()| (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>StaticRange: No mutate on DOM change</title>
5 <script src="../../../resources/testharness.js"></script>
6 <script src="../../../resources/testharnessreport.js"></script>
7 </head>
8 <body>
9 abcdefg
10 <script>
11 test(function() {
12 // Initialize.
13 var txt = document.body.firstChild;
14 var staticRange = new StaticRange();
15 staticRange.setStart(txt, 0);
16 staticRange.setEnd(txt, 5);
17 var range = staticRange.toRange();
18
19 // Split text and StaticRange shouldn't mutate.
20 txt.splitText(2);
21 assert_equals(staticRange.startContainer, txt);
22 assert_equals(staticRange.startOffset, 0);
23 assert_equals(staticRange.endContainer, txt);
24 assert_equals(staticRange.endOffset, 5);
25
26 // Range should mutate.
27 assert_equals(range.startContainer, txt);
28 assert_equals(range.startOffset, 0);
29 assert_equals(range.endContainer, txt.nextSibling);
30 assert_equals(range.endOffset, 3);
31 }, 'Testing StaticRange wont mutate on DOM change');
32 </script>
33 </body>
34 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698