Skip to content
This repository has been archived by the owner on Aug 30, 2018. It is now read-only.

<html class="no-js"> #41

Closed
suture opened this issue Apr 16, 2014 · 2 comments · Fixed by #42
Closed

<html class="no-js"> #41

suture opened this issue Apr 16, 2014 · 2 comments · Fixed by #42

Comments

@suture
Copy link

suture commented Apr 16, 2014

I'm just wondering why this class (no-js) is assigned to the html tag? It seems that Timber doesn't include Modernizer.

Also adding the following line of code in shop.js.liquid doesn't seem to remove the class (no-js)

$('html').removeClass('no-js');

If you check the rendered source, the class remains, even when the browser supports JS.

I've tested it in both Firefox and Safari (the latest versions) on a Mac.

Maybe I misunderstand how it works?

@cshold cshold mentioned this issue Apr 16, 2014
@suture
Copy link
Author

suture commented Apr 17, 2014

I think I worked it out.

It's meant to remove the "no-js" class, but this change is only visible in the computed source not "View Source".

Currently the computed source looks like this, which I think must be incorrect.
ss_002

<html class>

Paul Irish suggests re http://www.paulirish.com/2009/avoiding-the-fouc-v3/

<head>
  <script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>

@cshold
Copy link
Contributor

cshold commented Apr 17, 2014

Don't worry about the conditional comments. You can see in your screenshot that the HTML tag doesn't have any class associated with it. The conditional comments are only valid in IE, and therefore only have the class removed from the tag in those browsers.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants