On Fri, Dec 16, 2011 at 10:21 AM, Karl Swedberg <[email protected]> wrote:
> > On Dec 16, 2011, at 10:05 AM, Claus Reinke wrote: > > > There is a widespread pattern on the web that I don't understand. > <snip> > > The problem is that users who disable Javascript by default see > > nothing at all on such sites, even though the content could be read just > fine by removing the default styling. Try the example. > > I agree that this is a problem (or "anti-pattern"). > > > > If the rationale above is correct, there would seem to be a simple > workaround, which is to hide content via a css class, and to attach that > class dynamically, before the content is parsed and rendered. > > That way content is hidden by default only when script is enabled: > > This is the approach I've taken, as well, except I'd recommend adding the > class the the html element and put the script in the <head>. I actually > thought this approach was pretty widespread, as well. But maybe not. > Anyway, I wrote about it three years ago: > http://www.learningjquery.com/2008/10/1-way-to-avoid-the-flash-of-unstyled-content Great reference. Another is http://paulirish.com/2009/avoiding-the-fouc-v3/and http://paulirish.com/2009/avoiding-the-fouc-v3/#comment-34951 both linked to from html5boilerplate.com docs. What this second link adds specifically to the conversation is deciding to remove a no-js class vs adding a js class can affect the specificity. Worth considering. - Richard -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
