OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <style type="text/css"> | 4 <style type="text/css"> |
5 div > * { | 5 div > * { |
6 display: block; | 6 display: block; |
7 } | 7 } |
8 </style> | 8 </style> |
9 </head> | 9 </head> |
10 <body> | 10 <body> |
11 <div id="test" contenteditable><hr><datagrid></datagrid><object></object></div> | 11 <div id="test" contenteditable><hr><datagrid></datagrid><object></object></div> |
12 <script src="../../resources/dump-as-markup.js"></script> | 12 <script src="../../resources/dump-as-markup.js"></script> |
13 <script> | 13 <script> |
14 | 14 |
15 var test = document.getElementById('test'); | 15 var test = document.getElementById('test'); |
16 test.focus(); | 16 test.focus(); |
17 | 17 |
18 Markup.description('This test ensures WebKit does not ignore the content of hr,
datagrid, and object with child nodes.') | 18 Markup.description('This test ensures WebKit does not ignore the content of hr,
datagrid, and object with child nodes.') |
19 | 19 |
20 var text = 'hello world WebKit'; | 20 var text = 'hello world WebKit'; |
21 | 21 |
22 for (var i = 0; i < test.childNodes.length; i++) { | 22 for (var i = 0; i < test.childNodes.length; i++) { |
23 var textNode = document.createTextNode(text); | 23 var textNode = document.createTextNode(text); |
24 test.childNodes[i].appendChild(textNode); | 24 test.childNodes[i].appendChild(textNode); |
25 // OBJECT fallback content rendering is asynchronous. | 25 // OBJECT fallback content rendering is asynchronous. |
26 if (window.internals) | 26 if (window.internals) |
27 internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(); | 27 internals.updateStyleAndLayoutIgnorePendingStylesheetsAndRunPostLayoutTa
sks(); |
28 window.getSelection().setBaseAndExtent(textNode, 6, textNode, 11); | 28 window.getSelection().setBaseAndExtent(textNode, 6, textNode, 11); |
29 document.execCommand('bold', false, null); | 29 document.execCommand('bold', false, null); |
30 } | 30 } |
31 | 31 |
32 Markup.dump(test, '"world" and only "world" should be bolded in each element bel
ow'); | 32 Markup.dump(test, '"world" and only "world" should be bolded in each element bel
ow'); |
33 | 33 |
34 window.getSelection().collapse(test, 0); | 34 window.getSelection().collapse(test, 0); |
35 | 35 |
36 for (var i = 0; i < (text.length + 1) * test.childNodes.length - 1; i++) | 36 for (var i = 0; i < (text.length + 1) * test.childNodes.length - 1; i++) |
37 window.getSelection().modify('extend', 'forward', 'character'); | 37 window.getSelection().modify('extend', 'forward', 'character'); |
38 | 38 |
39 var range = window.getSelection().getRangeAt(0).cloneContents(); | 39 var range = window.getSelection().getRangeAt(0).cloneContents(); |
40 | 40 |
41 Markup.dump(range, 'The result below should be identical to the result above'); | 41 Markup.dump(range, 'The result below should be identical to the result above'); |
42 | 42 |
43 </script> | 43 </script> |
44 </body> | 44 </body> |
45 </html> | 45 </html> |
OLD | NEW |