upload tizen1.0 source
[framework/web/webkit-efl.git] / LayoutTests / editing / execCommand / 5685604-1.html
1 <body>
2 <p>This tests to make sure that execCommand("styleWithCSS", ...) is supported and turns on the use of legacy tags in leu of CSS-styled spans for formatting changes.</p>
3 <div contenteditable="true" id="div">The second and last words in this sentence should be bold.</div>
4 <ul id="console"></ul>
5 <script>
6 function log(msg) {
7     console = document.getElementById("console");
8     text = document.createTextNode(msg);
9     li = document.createElement("li");
10     console.appendChild(li);
11     li.appendChild(text);
12 }
13 r = document.createRange();
14 div = document.getElementById("div");
15 text = div.firstChild;
16 window.getSelection().setBaseAndExtent(text, 4, text, 10);
17 document.execCommand("bold", false, "");
18 window.getSelection().setBaseAndExtent(text, text.length - 5, text, text.length - 1);
19
20 if (document.queryCommandSupported("styleWithCSS"))
21     log("Success. execCommand(\"styleWithCSS\", ...) is supported.");
22 else
23     log("Failure. execCommand(\"styleWithCSS\", ...) is not supported.");
24     
25 document.execCommand("styleWithCSS", false, true);
26 document.execCommand("bold", false, "");
27
28 expectedHTML = "The <b>second</b> and last words in this sentence should be <span style=\"font-weight: bold;\">bold</span>.";
29
30 if (div.innerHTML == expectedHTML)
31     log("Success. A legacy formatting tag was used for styling by default, and execCommand(\"styleWithCSS\", ..., true) activated the use of CSS styling.");
32 else
33     log("Failure. Expected: " + expectedHTML);
34
35 if (window.layoutTestController) {
36     window.layoutTestController.dumpAsText();
37     document.body.innerText = document.getElementById("console").innerText;
38 }
39 </script>
40 </body>