OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <title>StaticRange: constructor</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 // Basic interface. | |
13 assert_equals(typeof new StaticRange, 'object'); | |
14 assert_equals(Object.prototype.toString.call(new StaticRange), '[object Stat
icRange]'); | |
15 assert_true(new StaticRange instanceof StaticRange); | |
16 assert_equals(Object.getPrototypeOf(new StaticRange), StaticRange.prototype)
; | |
17 | |
18 // Initialize new StaticRange. | |
19 var txt = document.body.firstChild; | |
20 var staticRange = new StaticRange(); | |
21 staticRange.setStart(txt, 0); | |
22 staticRange.setEnd(txt, 5); | |
23 assert_equals(staticRange.startContainer, txt); | |
24 assert_equals(staticRange.startOffset, 0); | |
25 assert_equals(staticRange.endContainer, txt); | |
26 assert_equals(staticRange.endOffset, 5); | |
27 assert_false(staticRange.collapsed); | |
28 | |
29 // Property mutable. | |
30 staticRange.startContainer = document.body; | |
31 staticRange.startOffset = 0; | |
32 staticRange.endContainer = document.body; | |
33 staticRange.endOffset = 0; | |
34 assert_equals(staticRange.startContainer, document.body); | |
35 assert_equals(staticRange.startOffset, 0); | |
36 assert_equals(staticRange.endContainer, document.body); | |
37 assert_equals(staticRange.endOffset, 0); | |
38 assert_true(staticRange.collapsed); | |
39 }, 'Testing StaticRange constructor'); | |
40 </script> | |
41 </body> | |
42 </html> | |
OLD | NEW |