Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / editing / pasteboard / paste-noscript.html
1 <script>
2 function sayHello()
3 {
4     alert("Hello");
5 }
6 if (window.testRunner)
7      testRunner.dumpAsText();
8 </script>
9 <div id="description">
10 This test copies all the elements containing event handlers and javascript urls, pastes them
11 in an editable area and verifies that no script, handlers or javascript urls are copied.
12 </div>
13 <div id="test" >
14 <button id="button1" onclick="sayHello()" ondblclick="sayHello()" style="width: 100px;">Hello</button>
15 <br>
16 <a id="anchor1" href="http://www.cnn.com/">CNN</a>
17 <a id="anchor2" href="javascript:sayHello()">Hello</a>
18 <iframe id="iframe1" src="javascript:var x = 1;" style="width: 200px; height: 100px; background-color:#cee;"></iframe>
19 <iframe id="iframe2" srcdoc="<script>var x = 1;</script>" style="width: 200px; height: 100px; background-color:#cee;"></iframe>
20 <form id="form1" action="javascript:sayHello()" formaction="javascript:sayHello()" style="width: 200px; height: 150px; background-color:#cee;">This is a form<br><img src="../resources/abe.png"></img><button formaction="javascript:sayHello()">Submit.</button></form>
21 </div>
22 <div id="pastehere" contenteditable="true">
23 </div>
24 <ul id="console"></ul>
25 <script>
26 var s = window.getSelection();
27 var p1 = document.getElementById("test");
28 s.collapse(p1, 0);
29 s.setBaseAndExtent(p1, 0, p1, 14);
30 document.execCommand("Copy");
31 p1 = document.getElementById("pastehere");
32 s.collapse(p1, 0);
33 document.execCommand("Paste");
34
35 log(document.getElementById("button1").outerHTML);
36 log(document.getElementById("pastehere").childNodes[0].outerHTML);
37
38 log(document.getElementById("anchor1").outerHTML);
39 log(document.getElementById("pastehere").childNodes[3].outerHTML);
40
41 log(document.getElementById("anchor2").outerHTML);
42 log(document.getElementById("pastehere").childNodes[5].outerHTML);
43
44 log(document.getElementById("iframe1").outerHTML);
45 log(document.getElementById("pastehere").childNodes[7].outerHTML);
46
47 log(document.getElementById("iframe2").outerHTML);
48 log(document.getElementById("pastehere").childNodes[9].outerHTML);
49
50 log(document.getElementById("form1").outerHTML);
51 log(document.getElementById("pastehere").childNodes[10].outerHTML);
52
53 function log(str) {
54     var li = document.createElement("li");
55     li.appendChild(document.createTextNode(str));
56     var console = document.getElementById("console");
57     console.appendChild(li);
58 }
59 </script>