blob: 16e1fa896ef93b006ec395e39872252bd42c41d3 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<svg xmlns="http://www.w3.org/2000/svg" style="display:none"><tref id="tref" /></svg>
<pre id="console"></pre>
<script>
description("Tests to ensure that shadow element cannot be created in elements having dynamically created shadow root.");
function testToAddShadowRoot(element, success) {
debug(element.nodeName);
if (success)
shouldNotBe("element.webkitCreateShadowRoot()", "null");
else
shouldThrow("element.webkitCreateShadowRoot()");
}
var elementsToSuccess = [
document.createElement('div'),
document.createElement('span'),
document.createElement('a'),
document.createElement('section'),
];
var elementsToFail = [
document.createElement('input'),
document.getElementById('tref'),
document.createElement('audio'),
document.createElement('video'),
document.createElement('select'),
document.createElement('img'),
document.createElement('textarea'),
document.createElement('iframe'),
document.createElement('canvas'),
document.createElement('meter'),
document.createElement('progress'),
document.createElement('object'),
document.createElement('embed'),
document.createElement('keygen'),
document.createElement('video'),
document.createElement('audio'),
document.createElement('fieldset'),
];
for (var i = 0; i < elementsToSuccess.length; ++i) {
var element = elementsToSuccess[i];
testToAddShadowRoot(element, true);
}
for (var i = 0; i < elementsToFail.length; ++i) {
var element = elementsToFail[i];
testToAddShadowRoot(element, false);
}
var successfullyParsed = true;
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>