editor/reftests/388980-1.html

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

     1 <html>
     2 <head>
     3 <title>Reftest for bug 388980</title></html>
     4 <script type="text/javascript">
     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>';
    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 }	
    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();
    28 	// Test hilighting with styleWithCSS, should hilight the text...
    29 	doc.execCommand("styleWithCSS", false, true);
    30 	colorPar("redpar", "red");
    32 	// Test highlighting without styleWithCSS, should also work.
    33 	doc.execCommand("styleWithCSS", false, false);
    34 	colorPar("bluepar", "blue");
    36 }
    37 </script>
    38 </head>
    39 <body>
    40 <iframe id="theIFrame" onload="initIFrame()">
    41 </iframe>
    42 </body>
    43 </html>

mercurial