Files
zcorpan 16a1222161 Bug 1850935 [wpt PR 41733] - HTML: rendering of <embed hidden> and <embed hidden=until-found>, a=testonly
Automatic update from web-platform-tests
HTML: rendering of <embed hidden> and <embed hidden=until-found>

See https://github.com/whatwg/html/pull/9664

--

wpt-commits: b6d002e21b44f4afd75bf1d959c65a1e5ce3c927
wpt-pr: 41733
2023-09-13 11:39:56 +00:00

53 lines
1.8 KiB
HTML

<!doctype html>
<link rel=help href="https://html.spec.whatwg.org/#hidden-elements">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div hidden></div>
<embed hidden>
<embed hidden=until-found>
<script>
const kNotHiddenElementLocalNames = [
"source", "track",
];
const kHiddenElementLocalNames = [
"area", "base", "basefont", "datalist", "head", "link", "meta", "noembed",
"noframes", "param", "rp", "script", "style", "template", "title",
];
for (let name of kNotHiddenElementLocalNames) {
test(function() {
let element = document.createElement(name);
document.body.appendChild(element);
assert_equals(getComputedStyle(element).display, "inline");
}, `${name} should not be hidden`);
}
for (let name of kHiddenElementLocalNames) {
test(function() {
let element = document.createElement(name);
document.body.appendChild(element);
assert_equals(getComputedStyle(element).display, "none");
}, `${name} should be hidden`);
}
test(function() {
assert_equals(getComputedStyle(document.querySelector("div[hidden]")).display, "none");
}, `div[hidden] element should be hidden`);
test(function() {
const el = document.querySelector("embed[hidden='']");
assert_equals(getComputedStyle(el).display, "inline");
assert_equals(getComputedStyle(el).width, "0px");
assert_equals(getComputedStyle(el).height, "0px");
}, `embed[hidden=''] element should be inline 0x0`);
test(function() {
const el = document.querySelector("embed[hidden='until-found']");
assert_equals(getComputedStyle(el).display, "inline");
assert_equals(getComputedStyle(el).width, "0px");
assert_equals(getComputedStyle(el).height, "0px");
assert_equals(getComputedStyle(el).contentVisibility, "visible");
}, `embed[hidden='until-found'] element should be inline 0x0`);
</script>