[whatwg] <nostyle> consideration

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  

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

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

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

regards, Kornel Lesinski

Received on Tuesday, 16 June 2009 16:29:09 UTC