W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2009

[whatwg] <nostyle> consideration

From: Kornel Lesinski <kornel@geekhood.net>
Date: Wed, 17 Jun 2009 00:29:09 +0100
Message-ID: <op.uvm4uvliptj49s@aimac.local>
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
Received on Tuesday, 16 June 2009 16:29:09 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:13 UTC