[whatwg] <nostyle> consideration

Thomas Powell tpowell at gmail.com
Mon Jun 15 13:26:21 PDT 2009


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 Obvious Push Back
---------------------

Why bother? You can just do this

.nostyle {display: none;}

<h2 class="nostyle">Warning: Styles required for correct rendering</h2>


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.
 This of course makes the idea of


 <h2 style="display:none;"><img src="error.php?style=off">Warning: Styles
required for correct rendering</h2>

kind of useless.

Obviously detecting style availability is no problem using JavaScript, just
measure some style region or compute a style.  However, in the absence of
JavaScript it is actually somewhat of a challenge to detect this case you
have to look for dependent requests as a clue like some style only available
background-image or something.

These corner cases aren't necessarily the main concerns, a serious
motivation for this element is also because of some of the nonsense I am
observing with background-image and content property near abuse by CSS
wonks.  It appears that there is a fairly decent sized camp of CSS for
everything and this element might help mitigate some problems stemming from
this.  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: " (*) "}

or for offsite links

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

or any other dynamic insert this way.  In my book effort I am seeing
tremendous interest in the design community with such rules.  Without style
you lose valuable data and there is no easy recourse to present this
situation at least not one without using JavaScript.  At least having
warnings via a nostyle element would be assisitive in informing users that
this isn't quite right and in some cases I might dream up helpful for
accessibility in light of too much CSS abuse.


Just an aside: The content property is the CSS cousin of document.write if
you think about it, useful but problematic.


So given that noscript correctly acts in masking content for user agents
supporting and not for those off or unsupporting, the nostyle element seems
like a quite logical solution for the other technology key client-side tech.

Anyway if this were an acceptable addition, tag syntax would be quite simple
would only have common attributes, pretty basic replication of noscript
prose in the specification.  Though of course this is one element that would
require browser changes, no quick simulation with JS.


Comments?


-Thomas Powell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20090615/5b62cf6a/attachment-0002.htm>


More information about the whatwg mailing list