editor/reftests/388980-1.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/editor/reftests/388980-1.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,43 @@
     1.4 +<html>
     1.5 +<head>
     1.6 +<title>Reftest for bug 388980</title></html>
     1.7 +<script type="text/javascript">
     1.8 +
     1.9 +var text = '<html><head></head><body style="font-size:16px;">'
    1.10 +	+ '<p id="redpar">This paragraph should be red</p>'
    1.11 +	+ '<p id="bluepar">This paragraph should be blue</p>'
    1.12 +	+ '<p>This paragraph should not be colored</p>'
    1.13 +	+'</body></html>';
    1.14 +
    1.15 +
    1.16 +function colorPar(par, color) {
    1.17 +	var doc = document.getElementById('theIFrame').contentDocument;
    1.18 +	var win = document.getElementById('theIFrame').contentWindow;
    1.19 +	win.getSelection().selectAllChildren(doc.getElementById(par));
    1.20 +	doc.execCommand("hilitecolor", false, color);
    1.21 +	win.getSelection().removeAllRanges();
    1.22 +}	
    1.23 +	
    1.24 +function initIFrame() {
    1.25 +	var doc = document.getElementById('theIFrame').contentDocument;
    1.26 +	doc.designMode = 'on';
    1.27 +	doc.open('text/html');
    1.28 +	doc.write(text);
    1.29 +	doc.close();
    1.30 +	
    1.31 +	// Test hilighting with styleWithCSS, should hilight the text...
    1.32 +	doc.execCommand("styleWithCSS", false, true);
    1.33 +	colorPar("redpar", "red");
    1.34 +
    1.35 +	// Test highlighting without styleWithCSS, should also work.
    1.36 +	doc.execCommand("styleWithCSS", false, false);
    1.37 +	colorPar("bluepar", "blue");
    1.38 +
    1.39 +}
    1.40 +</script>
    1.41 +</head>
    1.42 +<body>
    1.43 +<iframe id="theIFrame" onload="initIFrame()">
    1.44 +</iframe>
    1.45 +</body>
    1.46 +</html>

mercurial