2b4517bc7aa4ac8c281875630367fd60b61a4ffe
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / editing / execCommand / remove-formatting.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../../resources/dump-as-markup.js"></script>
5 <div id="test" contenteditable="true">
6 <b>foo</b><a href="http://www.google.com/">bar</a><i>baz</i><br>
7 <table border="1"><tr><td>foo</td><td>bar</td><td>baz</td></tr></table>
8 <u>foo</u>bar<span style="text-decoration:line-through">baz</span><br>
9 </div>
10 <pre id="console"></pre>
11 <script>
12
13 if (window.testRunner)
14     testRunner.dumpEditingCallbacks();
15
16 function log(message) {
17     var console = document.getElementById("console");
18     console.innerHTML += message + '\n';
19 }
20
21 var e = document.getElementById("test");
22 var s = window.getSelection();
23
24 if (document.queryCommandEnabled("RemoveFormat"))
25     log("Failure: RemoveFormat enabled with no selection.");
26 s.collapse(e, 0);
27 if (document.queryCommandEnabled("RemoveFormat"))
28     log("Failure: RemoveFormat enabled with a caret selection.");
29 document.execCommand("SelectAll");
30 if (!document.queryCommandEnabled("RemoveFormat"))
31     log("Failure: RemoveFormat disabled with an editable selection.");
32 if (!document.execCommand("RemoveFormat"))
33     log("Failure: execCommand('RemoveFormat') returned false.");
34
35 Markup.description('This is a test for execCommand("RemoveFormat"). It demonstrates a bug: everything in the editable region below should be selected, as everything was selected before Remove Format was performed.');
36 Markup.dump(e, 'markup');
37 Markup.dump('console', 'console');
38
39 </script>
40 </body>
41 </html>