|
1 <html> |
|
2 <head> |
|
3 <title>Reftest for bug 388980</title></html> |
|
4 <script type="text/javascript"> |
|
5 |
|
6 var text = '<html><head></head><body style="font-size:16px;">' |
|
7 + '<p id="redpar">This paragraph should be red</p>' |
|
8 + '<p id="bluepar">This paragraph should be blue</p>' |
|
9 + '<p>This paragraph should not be colored</p>' |
|
10 +'</body></html>'; |
|
11 |
|
12 |
|
13 function colorPar(par, color) { |
|
14 var doc = document.getElementById('theIFrame').contentDocument; |
|
15 var win = document.getElementById('theIFrame').contentWindow; |
|
16 win.getSelection().selectAllChildren(doc.getElementById(par)); |
|
17 doc.execCommand("hilitecolor", false, color); |
|
18 win.getSelection().removeAllRanges(); |
|
19 } |
|
20 |
|
21 function initIFrame() { |
|
22 var doc = document.getElementById('theIFrame').contentDocument; |
|
23 doc.designMode = 'on'; |
|
24 doc.open('text/html'); |
|
25 doc.write(text); |
|
26 doc.close(); |
|
27 |
|
28 // Test hilighting with styleWithCSS, should hilight the text... |
|
29 doc.execCommand("styleWithCSS", false, true); |
|
30 colorPar("redpar", "red"); |
|
31 |
|
32 // Test highlighting without styleWithCSS, should also work. |
|
33 doc.execCommand("styleWithCSS", false, false); |
|
34 colorPar("bluepar", "blue"); |
|
35 |
|
36 } |
|
37 </script> |
|
38 </head> |
|
39 <body> |
|
40 <iframe id="theIFrame" onload="initIFrame()"> |
|
41 </iframe> |
|
42 </body> |
|
43 </html> |