OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <meta charset="utf-8"> |
3 <head> | 3 <script src="../../resources/testharness.js"></script> |
4 <meta http-equiv="content-type" content="text/html; charset=utf-8"> | 4 <script src="../../resources/testharnessreport.js"></script> |
5 <style> .selected { color: blue; } </style> | |
6 </head> | |
7 <body> | |
8 <p>This tests horizontal caret movement in vertical writing mode. "ある。" and "名前は
まだ" must be selected.</p> | 5 <p>This tests horizontal caret movement in vertical writing mode. "ある。" and "名前は
まだ" must be selected.</p> |
9 <div id="test" style="height: 30ex; -webkit-writing-mode: vertical-rl; outline:
none;" contenteditable> | 6 <div style="height: 30ex; -webkit-writing-mode: vertical-rl; outline: none;" con
tenteditable> |
10 <p>吾輩は猫である。</p> | 7 <p id="p1">吾輩は猫である。</p> |
11 <p>名前はまだ無い。</p> | 8 <p id="p2">名前はまだ無い。</p> |
12 </div> | 9 </div> |
13 <pre id="log"></pre> | 10 <div id="log"></div> |
14 <script> | 11 <script> |
| 12 test(function() { |
| 13 var selection = window.getSelection(); |
| 14 var p1 = document.getElementById('p1'); |
| 15 var p2 = document.getElementById('p2'); |
| 16 selection.collapse(p2.firstChild, 5); |
| 17 selection.modify('Extend', 'Backward', 'Line'); |
15 | 18 |
16 var test = document.getElementById('test'); | 19 assert_false(selection.isCollapsed, 'isCollapsed'); |
17 window.getSelection().collapse(test.getElementsByTagName('p')[1].lastChild, 5); | 20 assert_equals(selection.anchorNode, p2.firstChild, 'anchorNode'); |
18 window.getSelection().modify('Extend', 'Backward', 'Line'); | 21 assert_equals(selection.anchorOffset, 5, 'anchorOffset'); |
19 | 22 assert_equals(selection.focusNode, p1.firstChild, 'focusNode'); |
| 23 assert_equals(selection.focusOffset, 5, 'focusOffset'); |
| 24 }); |
20 </script> | 25 </script> |
21 </body> | |
22 </html> | |
OLD | NEW |