blob: 5b64d4cf46192589c723d3b4f12a0431993d5a0a [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<script>
description("Test support for DOMTokenList.supports()");
shouldBeType("DOMTokenList.prototype.supports", "Function");
debug("");
debug("* HTMLLinkElement.relList");
var link = document.createElement("link");
shouldBe("link.relList.__proto__", "DOMTokenList.prototype");
var linkRelSupportedValues = ["alternate", "dns-prefetch", "icon", "stylesheet"];
for (var i = 0; i < linkRelSupportedValues.length; i++) {
shouldBeTrue("link.relList.supports(linkRelSupportedValues[i])");
shouldBeTrue("link.relList.supports(linkRelSupportedValues[i].toUpperCase())");
}
shouldBeFalse("link.relList.supports('unsupported')");
debug("");
debug("* HTMLAnchorElement.relList");
var anchor = document.createElement("a");
shouldBe("anchor.relList.__proto__", "DOMTokenList.prototype");
var anchorRelSupportedValues = ["noreferrer", "noopener"];
for (var i = 0; i < anchorRelSupportedValues.length; i++) {
shouldBeTrue("anchor.relList.supports(anchorRelSupportedValues[i])");
shouldBeTrue("anchor.relList.supports(anchorRelSupportedValues[i].toUpperCase())");
}
shouldBeFalse("anchor.relList.supports('unsupported')");
debug("");
debug("* HTMLAreaElement.relList");
var area = document.createElement("area");
shouldBe("area.relList.__proto__", "DOMTokenList.prototype");
var areaRelSupportedValues = ["noreferrer", "noopener"];
for (var i = 0; i < areaRelSupportedValues.length; i++) {
shouldBeTrue("area.relList.supports(areaRelSupportedValues[i])");
shouldBeTrue("area.relList.supports(areaRelSupportedValues[i].toUpperCase())");
}
shouldBeFalse("area.relList.supports('unsupported')");
debug("");
debug("* HTMLIFrameElement.sandbox");
var iframe = document.createElement("iframe");
shouldBe("iframe.sandbox.__proto__", "DOMTokenList.prototype");
var iframeSandboxSupportedValues = ["allow-forms", "allow-same-origin", "allow-scripts", "allow-top-navigation", "allow-pointer-lock", "allow-popups"];
for (var i = 0; i < iframeSandboxSupportedValues.length; i++) {
shouldBeTrue("iframe.sandbox.supports(iframeSandboxSupportedValues[i])");
shouldBeTrue("iframe.sandbox.supports(iframeSandboxSupportedValues[i].toUpperCase())");
}
shouldBeFalse("iframe.sandbox.supports('unsupported')");
debug("");
debug("* HTMLLinkElement.sizes");
shouldBe("link.sizes.__proto__", "DOMTokenList.prototype");
shouldThrowErrorName("link.sizes.supports('token')", "TypeError");
debug("");
debug("* HTMLOutputElement.htmlFor");
var output = document.createElement("output");
shouldBe("output.htmlFor.__proto__", "DOMTokenList.prototype");
shouldThrowErrorName("output.htmlFor.supports('token')", "TypeError");
debug("");
debug("* HTMLElement.dropzone");
if (link.dropzone) {
shouldBe("link.dropzone.__proto__", "DOMTokenList.prototype");
var dropzoneSupportedValues = ["copy", "move", "link"];
for (var i = 0; i < dropzoneSupportedValues.length; i++) {
shouldBeTrue("link.dropzone.supports(dropzoneSupportedValues[i])");
shouldBeTrue("link.dropzone.supports(dropzoneSupportedValues[i].toUpperCase())");
}
shouldBeFalse("link.dropzone.supports('unsupported')");
} else
testFailed("HTMLElement.dropzone is not supported.");
debug("");
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>