- From: Glenn Maynard <glenn@zewt.org>
- Date: Wed, 30 Apr 2014 09:32:37 -0500
- To: Anne van Kesteren <annevk@annevk.nl>
- Cc: whatwg <whatwg@whatwg.org>, David Bruant <bruant.d@gmail.com>
Previous discussion: http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-November/037905.html On Wed, Apr 30, 2014 at 6:01 AM, Anne van Kesteren <annevk@annevk.nl> wrote: > >> <div hidden></div> > >> > >> Per spec, the div should be shown right? I imagine there is no way back > on > >> that? > > We could change the specification to use display-box instead. That might > work. > It's too bad that display-box also has multiple uses--it doesn't only display or hide the content, it has a third "contents" mode. That means the same problem would happen as soon as you set "display-box: contents" on something--it would override [hidden]. What we really need is a CSS property that only sets whether the element is visible or not and nothing else, like "visible: false". That way, the only way [hidden] gets overridden is if you're actually setting the visibility style. I assume it's too late to change the style [hidden] uses, though. Lots of pages do things like "d = elem.style.display; elem.style.display = "block"; width = elem.style.offsetWidth; elem.style.display = d;" to work around offset* being 0 while hidden, and if [hidden] changes to some other style (or to !important) that code will break. I always just put [hidden] { display: none !important; } in my stylesheets to work around this. That sucks, since it makes [hidden] in pages and scripts I write incompatible with everyone else, who may be writing scripts that don't understand this (such as the above pattern), or may work around it in some other way. -- Glenn Maynard
Received on Wednesday, 30 April 2014 14:33:33 UTC