[whatwg] <nostyle> consideration

Kornel Lesinski kornel at geekhood.net
Tue Jun 16 16:29:09 PDT 2009


On Tue, 16 Jun 2009 11:51:05 +0100, Aryeh Gregor  
<Simetrical+w3c at gmail.com> wrote:

>> <noscript> is a very poor solution, and <nostyle> would be too. You  
>> should use graceful degradation/progressive enhancement instead (in  
>> both cases).
>
> Graceful degradation is not necessarily possible with JavaScript.  For
> instance, consider a real-time game written in JavaScript.

True, but <noscript> doesn't allow implementation of games either.

What matters is cases where fallback is possible, and where <nostyle>  
would improve it.

> Sometimes <noscript> can be used for graceful fallback, too.  For
> instance, if a script normally generates an element dynamically when
> needed, the element might be placed statically inside <noscript> so
> that it always appears if script is disabled.  (For instance, a
> "Nationality" form in a field that only appears if a radio control is
> changed from the default of "U.S. Citizen".)  Without <noscript>, the
> only way I know of to allow graceful fallback is to do something like
> hide the element onload, which will make it briefly visible.

It doesn't have to be briefly visible. Don't use onload, but an inline  
script:

<div id="hideme">
	<script>document.getElementById('hideme').hidden = true</script>
	(in)visible content…
</div>


If your page uses DHTML a lot, and has fallback in many places, there's  
nice trick for it:

<head>
<script>document.documentElement.className += " script-supported"</script>
<style>.script-supported .dhtml-fallback {display:none}</style>

-- 
regards, Kornel Lesinski



More information about the whatwg mailing list