[whatwg] <nostyle> consideration

On Mon, Jun 15, 2009 at 4:26 PM, Thomas Powell<tpowell at gmail.com> wrote:
> Proposing <nostyle> in the spirit of <noscript>
>
> Examples
> --------
> 1) Head Usage
> <nostyle>
> ?<meta http-equiv="Refresh" content="0;url=/errors/stylerequired.html">
> </nostyle>
>
> 2) Body Usage
> <nostyle>
> ?<h2>Warning: Styles required for correct rendering</h2>
> </nostyle>

The reason that <noscript> worked is because (IIRC) it was introduced
at the same time as <script>.  All browsers that supported <script>
also supported <noscript>.  <nostyle> would cause all legacy user
agents to render the content even if they supported styles just fine.

> And yes while that is true and for many situations will work fine, there are
> other cases you won't and you can get a sloppy or even bad results because
> of rendering engine paths. ?For example, because style is not applied until
> later you have an issue here
>
> ?<h2 class="nostyle"><img src="error.gif">Warning: Styles required for
> correct rendering</h2>
>
> The network request happens regardless of situation no assuming images on.

That doesn't seem like a very serious issue.  Just don't use images if
you care that much.  A large percentage of non-CSS browsers are
probably text-based anyway.

> For example, using the content property can be somewhat troubling if
> style is removed. ?For example, consider what happens if you are putting in
> field required indicators
> input[type=text].required:before {content: " (*) "}

This should just use HTML5's required attribute instead of a class:

http://dev.w3.org/html5/spec/Overview.html#the-required-attribute

Conformant browsers should make it clear to the user that the field is
required even if styles are disabled.

> or for offsite links
> a[href^="http://"]:after {content:' ( Offsite Link )';}

This is non-essential info, and every browser I've heard of exposes it
anyway (e.g., by hovering over the link and looking in the lower
left).

> or any other dynamic insert this way.

Do you have any other examples where this is a significant issue?
Those two don't seem like a big deal to me, honestly, even if it were
logistically possible to get <nostyle> supported widely enough to be
useful.

If CSS is necessary for a site to operate, it's probably being
misused.  If an author is misusing CSS this badly, it's not clear to
me why they could be expected to reliably use <nostyle>.  The contents
of <nostyle> also don't make a difference to almost anyone, so authors
who use it won't really understand the purpose it serves and it will
probably be misused more often than used.

Received on Monday, 15 June 2009 14:14:23 UTC