OLD | NEW |
| (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> | |
OLD | NEW |