2007-10-02 21:44:21 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Reftest for bug 388980</title></html>
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
2009-09-23 14:55:55 +00:00
|
|
|
var text = '<html><head></head><body style="font-size:16px;">'
|
2007-10-02 21:44:21 +00:00
|
|
|
+ '<p id="redpar">This paragraph should be red</p>'
|
|
|
|
+ '<p id="bluepar">This paragraph should be blue</p>'
|
2012-04-17 10:18:08 +00:00
|
|
|
+ '<p>This paragraph should not be colored</p>'
|
2007-10-02 21:44:21 +00:00
|
|
|
+'</body></html>';
|
|
|
|
|
|
|
|
|
|
|
|
function colorPar(par, color) {
|
|
|
|
var doc = document.getElementById('theIFrame').contentDocument;
|
|
|
|
var win = document.getElementById('theIFrame').contentWindow;
|
|
|
|
win.getSelection().selectAllChildren(doc.getElementById(par));
|
|
|
|
doc.execCommand("hilitecolor", false, color);
|
|
|
|
win.getSelection().removeAllRanges();
|
|
|
|
}
|
|
|
|
|
|
|
|
function initIFrame() {
|
|
|
|
var doc = document.getElementById('theIFrame').contentDocument;
|
|
|
|
doc.designMode = 'on';
|
|
|
|
doc.open('text/html');
|
|
|
|
doc.write(text);
|
|
|
|
doc.close();
|
|
|
|
|
|
|
|
// Test hilighting with styleWithCSS, should hilight the text...
|
|
|
|
doc.execCommand("styleWithCSS", false, true);
|
|
|
|
colorPar("redpar", "red");
|
|
|
|
|
2012-04-17 10:18:08 +00:00
|
|
|
// Test highlighting without styleWithCSS, should also work.
|
2007-10-02 21:44:21 +00:00
|
|
|
doc.execCommand("styleWithCSS", false, false);
|
2012-04-17 10:18:08 +00:00
|
|
|
colorPar("bluepar", "blue");
|
2007-10-02 21:44:21 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<iframe id="theIFrame" onload="initIFrame()">
|
|
|
|
</iframe>
|
|
|
|
</body>
|
|
|
|
</html>
|