<!DOCTYPE html>
<html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<body>
<video controls id="v"></video>
<script>
description("Verify that removing a video element from the DOM does not crash.");
window.jsTestIsAsync = true;
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function runTest() {
if (!window.internals) {
finishJSTest();
return;
}
var video = document.getElementById('v');
var videoShadow = internals.shadowRoot(video);
traverse(videoShadow);
document.body.removeChild(video);
finishJSTest();
}
function traverse(node) {
if (!node)
return;
if (node.attributes)
Array.prototype.forEach.call(node.attributes, function (n) { node[n && n.localName] = 2; });
if (node.childNodes)
Array.prototype.forEach.call(node.childNodes, traverse);
if (node.localName == 'input')
traverse(internals.shadowRoot(node));
}
window.onload = runTest;
</script>
</html>