| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <body> |
| <p>Test that an element that was imported from a frameless document has functional attribute event listeners. Should alert "SUCCESS".</p> |
| <script> |
| <![CDATA[ |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| 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"); |
| |
| var a = doc.documentElement.firstChild.cloneNode(true); |
| document.getElementsByTagName("body")[0].appendChild(a); |
| |
| var event = document.createEvent('MouseEvent'); |
| event.initEvent('click', true, true); |
| document.getElementsByTagName('a')[0].dispatchEvent(event); |
| |
| if (0 == document.getElementsByTagName('a')[0].onclick.toString().indexOf("function onclick")) |
| document.body.appendChild(document.createTextNode("Element.onclick result is correct.")); |
| ]]> |
| </script> |
| </body> |
| </html> |