blob: a884c8c4789cda82ad0da92297e56950fcc082fc [file] [log] [blame]
<html>
<head>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
</head>
<body>
<script>
let test = async_test('An element removed by the adoption agency algorithm must not be inserted if it had been inserted elsewhere');
var p;
test.step(() => {
const iframe = document.createElement('iframe');
document.body.appendChild(iframe);
let doc = iframe.contentDocument;
doc.write(`<body><a id="target" href="#"></a>`);
const target = doc.querySelector('a');
target.onfocus = () => {
target.onfocus = null;
test.step(() => {
let container = doc.querySelector('div');
container.remove();
doc.body.appendChild(p);
});
setTimeout(() => {
test.step(() => {
assert_equals(p.parentNode, doc.body);
});
test.done();
iframe.remove();
}, 0);
}
doc.write(`<div><b><p><script>
parent.p = document.querySelector('p');
document.write('<link rel="stylesheet" href="data:,a${(new Date).toISOString() + Math.random()}">');
location.hash = 'target';
<\/script></b></p></div></body>`);
});
</script>
</body>
</html>