1 <html xmlns="http://www.w3.org/1999/xhtml">
3 <p>Test that an element that was imported from a frameless document has functional attribute event listeners. Should alert "SUCCESS".</p>
7 testRunner.dumpAsText();
9 var doc = (new DOMParser).parseFromString('<html xmlns="http://www.w3.org/1999/xhtml"><a id="a" href="javascript:alert(\'FAIL\')" onclick="alert(\'SUCCESS\'); return false">Link (clicked automatically).</a></html>', "application/xhtml+xml");
11 var a = doc.documentElement.firstChild.cloneNode(true);
12 document.getElementsByTagName("body")[0].appendChild(a);
14 var event = document.createEvent('MouseEvent');
15 event.initEvent('click', true, true);
16 document.getElementsByTagName('a')[0].dispatchEvent(event);
18 if (0 == document.getElementsByTagName('a')[0].onclick.toString().indexOf("function onclick"))
19 document.body.appendChild(document.createTextNode("Element.onclick result is correct."));