OLD | NEW |
---|---|
(Empty) | |
1 <!doctype HTML> | |
2 <script src="../../resources/testharness.js"></script> | |
3 <script src="../../resources/testharnessreport.js"></script> | |
4 <div contenteditable="true"> | |
5 <sub><i>1. Make text subscript and italic</i></sub> | |
6 <sup><i>2. Make text superscript and italic</i></sup> | |
7 </div> | |
8 <div id="log"></div> | |
9 <script> | |
10 function test_sub() { | |
11 document.getSelection().removeAllRanges(); | |
12 var range = document.createRange(); | |
13 range.selectNode(document.querySelector('i')); | |
14 document.getSelection().addRange(range); | |
15 | |
16 assert_equals(document.queryCommandState('subscript'), true); | |
17 } | |
18 | |
19 function test_sup() { | |
20 document.getSelection().removeAllRanges(); | |
21 var range = document.createRange(); | |
22 range.selectNode(document.querySelectorAll('i')[1]); | |
23 document.getSelection().addRange(range); | |
24 | |
25 assert_equals(document.queryCommandState('superscript'), true); | |
26 } | |
27 | |
28 function test_all(platform) { | |
29 if (platform) | |
30 internals.settings.setEditingBehavior(platform); | |
31 test(test_sub, `${platform}: run queryCommandState('subscript')`); | |
32 test(test_sup, `${platform}: run queryCommandState('superscript')`); | |
33 } | |
34 | |
35 (window.internals ? ['mac', 'win'] : ['']).forEach(test_all); | |
joone
2016/05/30 09:16:18
==> (window.internals ? ['mac', 'win',''] : ['']).
| |
36 </script> | |
OLD | NEW |