| <!DOCTYPE html> |
| <html> |
| <body onload="runTest()"> |
| <div id="container"></div> |
| <div id="child"></div> |
| <div><link id="link"></div> |
| <script src="../../resources/js-test-pre.js"></script> |
| <script> |
| |
| description('This tests removing a node during beforeload event.'); |
| |
| var exitingLink = document.querySelector('link'); |
| var newLink = document.createElement("link"); |
| newLink.innerHTML = '<link id="link">'; |
| |
| var child = document.getElementById('child'); |
| child.appendChild(newLink); |
| newLink.addEventListener('beforeload', () => { |
| document.getElementById("link").remove(); |
| }); |
| |
| document.getElementById('container').appendChild(child); |
| |
| shouldBe('document.getElementById("link")', 'exitingLink'); |
| |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |