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 id="test" style="height: 30ex; -webkit-writing-mode: vertical-rl; outline:
none;" contenteditable> |
10 <p>吾輩は猫である。</p> | 7 <p id="p1">吾輩は猫である。</p> |
11 <p>名前はまだ無い。</p> | 8 <p id="p2">名前はまだ無い。</p> |
12 </div> | 9 <div id="log"></div> |
13 <pre id="log"></pre> | |
14 <script> | 10 <script> |
| 11 test(function() { |
| 12 var selection = window.getSelection(); |
| 13 var p1 = document.getElementById('p1'); |
| 14 var p2 = document.getElementById('p2'); |
| 15 selection.collapse(p1.firstChild, 2); |
| 16 selection.modify('Extend', 'Forward', 'Line'); |
15 | 17 |
16 var test = document.getElementById('test'); | 18 assert_false(selection.isCollapsed, 'isCollapsed'); |
17 window.getSelection().collapse(test.getElementsByTagName('p')[0].firstChild, 2); | 19 assert_equals(selection.anchorNode, p1.firstChild, 'anchorNode'); |
18 window.getSelection().modify('Extend', 'Forward', 'Line'); | 20 assert_equals(selection.anchorOffset, 2, 'anchorOffset'); |
19 | 21 assert_equals(selection.focusNode, p2.firstChild, 'focusNode'); |
| 22 assert_equals(selection.focusOffset, 2, 'focusOffset'); |
| 23 }); |
20 </script> | 24 </script> |
21 </body> | |
22 </html> | |
OLD | NEW |