| <!DOCTYPE html> |
| <head> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| </head> |
| <body> |
| <script> |
| |
| let svgElement; |
| function moveIframe(svgDoc) { |
| if (svgElement) |
| return; |
| svgElement = svgDoc.documentElement; |
| const iframe = document.createElement('iframe'); |
| svgDoc.documentElement.appendChild(iframe); |
| iframe.contentWindow.onunload = () => { |
| document.body.appendChild(svgElement); |
| } |
| } |
| |
| const content = `<svg xmlns="http://www.w3.org/2000/svg"><script>parent.moveIframe(document);<\/script><element a="1" a="2"/></svg>`; |
| const iframe = document.createElement('iframe'); |
| iframe.src = URL.createObjectURL(new Blob([content], {type: 'text/xml'})); |
| document.documentElement.appendChild(iframe); |
| |
| window.onload = () => { |
| let test = async_test('An element removed by the adoption agency algorithm must not be inserted if it had been inserted elsewhere'); |
| test.step(() => { |
| assert_equals(svgElement.parentNode, document.body); |
| svgElement.remove(); |
| }); |
| test.done(); |
| } |
| |
| </script> |
| </body> |