From d670c13a3b95edafd41315a5a7a55b9b6a99309d Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Fri, 21 Jan 2022 18:56:01 -0500 Subject: [PATCH] LibWeb: Make attribute hidden have an effect; hide some other elements This moves LibWeb to using the list of hidden elements from the spec. Concretely, the following things are now explicitly marked `display: none` in addition to before: - elements with the `hidden` attribute - area - base - basefont - datalist - param - rp The spec also wants `noframes` and `noembed` to be `display: none`, but since support for frames and embeds doesn't exist yet, these are omitted for now. With this, everyone's favorite website http://45.33.8.238/ no longer displays spans with attribute hidden. (Whitespace handling still looks a bit off though.) --- Userland/Libraries/LibWeb/CSS/Default.css | 32 ++++++++++++++--------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/Default.css b/Userland/Libraries/LibWeb/CSS/Default.css index 3ba22059cf..1b5c9d17a6 100644 --- a/Userland/Libraries/LibWeb/CSS/Default.css +++ b/Userland/Libraries/LibWeb/CSS/Default.css @@ -7,15 +7,6 @@ a { cursor: pointer; } -head, -link, -meta, -script, -style, -title { - display: none; -} - body { margin: 8px; } @@ -186,10 +177,6 @@ colgroup { display: table-column-group; } -basefont { - display: block; -} - blockquote { margin-left: 25px; margin-right: 25px; @@ -243,3 +230,22 @@ summary { display: block; font-weight: bold; } + +/* 15.3.1 Hidden elements + * https://html.spec.whatwg.org/multipage/rendering.html#hidden-elements + */ +/* FIXME: Add `noframes` once frames are implemented. */ +/* FIXME: Add `noembed` once is implemented. */ +/* FIXME: Add `rp` once is implemented. */ +[hidden], area, base, basefont, datalist, head, link, meta, /*noembed,*/ +/*noframes,*/ param, /*rp,*/ script, style, template, title { + display: none; +} + +embed[hidden] { display: inline; height: 0; width: 0; } + +input[type=hidden i] { display: none !important; } + +@media (scripting) { + noscript { display: none !important; } +}