Skip to content

Commit 7f84d2b

Browse files
mfreed7chromium-wpt-export-bot
authored andcommitted
Make , and display:none
The spec [1] calls for these tags (along with several others) to be display:none. Previously, these three (plus - see below) were missing from html.css. With this CL, I've updated html.css to more- closely match the spec text. I also slightly changed the pre- existing test to check for display:none only, and not display:inline for and , because I could not find an explicit spec for that. If I'm wrong about that, someone please point me to the spec for those and I'll put the test back. This CL leaves unchanged for now, as it appears to break hit-testing of elements. This works, somehow, in WebKit, while still having elements display:none. TBD. [1] https://html.spec.whatwg.org/multipage/rendering.html#hidden-elements Bug: 1231263 Change-Id: Id67eed8a05a59174921b82783ced7958af8ff169 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3050793 Commit-Queue: Mason Freed Auto-Submit: Mason Freed Reviewed-by: Joey Arhar Cr-Commit-Position: refs/heads/master@{#908313}
1 parent 765042a commit 7f84d2b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

html/rendering/non-replaced-elements/hidden-elements.html

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,27 @@
1313
"noframes", "param", "rp", "script", "style", "template", "title",
1414
];
1515

16+
function isDisplayNone(element) {
17+
return getComputedStyle(element).display === "none";
18+
}
19+
1620
for (let name of kNotHiddenElementLocalNames) {
1721
test(function() {
1822
let element = document.createElement(name);
1923
document.body.appendChild(element);
20-
assert_equals(getComputedStyle(element).display, "inline");
21-
}, `${name} should not be hidden`);
24+
assert_false(isDisplayNone(element));
25+
}, `${name} should not be display:none`);
2226
}
2327

2428
for (let name of kHiddenElementLocalNames) {
2529
test(function() {
2630
let element = document.createElement(name);
2731
document.body.appendChild(element);
28-
assert_equals(getComputedStyle(element).display, "none");
29-
}, `${name} should be hidden`);
32+
assert_true(isDisplayNone(element));
33+
}, `${name} should be display:none`);
3034
}
3135

3236
test(function() {
33-
assert_equals(getComputedStyle(document.querySelector("[hidden]")).display, "none");
34-
}, `[hidden] element should be hidden`);
37+
assert_true(isDisplayNone(document.querySelector("[hidden]")));
38+
}, `[hidden] element should be display:none`);
3539
script>

0 commit comments

Comments
 (0)