7 testRunner
.dumpAsText();
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.
14 <button id=
"button1" onclick=
"sayHello()" ondblclick=
"sayHello()" style=
"width: 100px;">Hello
</button>
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
>
22 <div id
="pastehere" contenteditable
="true">
24 <ul id
="console"></ul
>
26 var s
= window
.getSelection();
27 var p1
= document
.getElementById("test");
29 s
.setBaseAndExtent(p1
, 0, p1
, 14);
30 document
.execCommand("Copy");
31 p1
= document
.getElementById("pastehere");
33 document
.execCommand("Paste");
35 log(document
.getElementById("button1").outerHTML
);
36 log(document
.getElementById("pastehere").childNodes
[0].outerHTML
);
38 log(document
.getElementById("anchor1").outerHTML
);
39 log(document
.getElementById("pastehere").childNodes
[3].outerHTML
);
41 log(document
.getElementById("anchor2").outerHTML
);
42 log(document
.getElementById("pastehere").childNodes
[5].outerHTML
);
44 log(document
.getElementById("iframe1").outerHTML
);
45 log(document
.getElementById("pastehere").childNodes
[7].outerHTML
);
47 log(document
.getElementById("iframe2").outerHTML
);
48 log(document
.getElementById("pastehere").childNodes
[9].outerHTML
);
50 log(document
.getElementById("form1").outerHTML
);
51 log(document
.getElementById("pastehere").childNodes
[10].outerHTML
);
54 var li
= document
.createElement("li");
55 li
.appendChild(document
.createTextNode(str
));
56 var console
= document
.getElementById("console");
57 console
.appendChild(li
);