OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../resources/js-test.js"></script> | 3 <script src="../../resources/js-test.js"></script> |
4 </head> | 4 </head> |
5 <body> | 5 <body> |
6 <div id="test"><span id="span1">foo</span><span>bar</span></div> | 6 <div id="test"><span id="span1">foo</span><span>bar</span></div> |
7 <div id="console"></div> | 7 <div id="console"></div> |
8 <script> | 8 <script> |
9 var s = window.getSelection(); | 9 var s = window.getSelection(); |
10 var testDiv = document.getElementById("test"); | 10 var testDiv = document.getElementById("test"); |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 // replace the selection with span1's children | 33 // replace the selection with span1's children |
34 s.selectAllChildren(span1); | 34 s.selectAllChildren(span1); |
35 shouldBe('window.getSelection().toString()', '"foo"'); | 35 shouldBe('window.getSelection().toString()', '"foo"'); |
36 | 36 |
37 // replace the selection with test's children | 37 // replace the selection with test's children |
38 s.selectAllChildren(test); | 38 s.selectAllChildren(test); |
39 shouldBe('window.getSelection().toString()', '"foobar"'); | 39 shouldBe('window.getSelection().toString()', '"foobar"'); |
40 | 40 |
41 // call with types other than Node | 41 // call with types other than Node |
42 shouldNotThrow('s.selectAllChildren(null)'); | 42 shouldThrow('s.selectAllChildren(null)'); |
43 shouldNotThrow('s.selectAllChildren(window)'); | 43 shouldThrow('s.selectAllChildren(window)'); |
44 shouldNotThrow('s.selectAllChildren("")'); | 44 shouldThrow('s.selectAllChildren("")'); |
45 </script> | 45 </script> |
46 </body> | 46 </body> |
47 </html> | 47 </html> |
OLD | NEW |