Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What does class="no-js" do? #108

Closed
kodiakbrown opened this issue Jun 4, 2021 · 1 comment · Fixed by #112
Closed

What does class="no-js" do? #108

kodiakbrown opened this issue Jun 4, 2021 · 1 comment · Fixed by #112

Comments

@kodiakbrown
Copy link

Hi, thank you for fixing issue #100! I've been trying to figure out what does class="no-js" do in the output html header? There's no "no-js" in any of the css or javascript resources. All of my rendered files have this header:

<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" class="no-js"><head>...

I found some documentation on it here: https://alistapart.com/article/taking-advantage-of-html5-and-css3-with-modernizr/
It mentions to "add the class “no-js” to the html element, when Modernizr runs, it will replace that class with the class “js” which allows you to ..."

But without using modernizr, how does the class ever get replaced by the "js" class as mentioned in the link?

Thank you!

@ndw
Copy link
Contributor

ndw commented Jun 4, 2021

It's used by the theme-picker extension. It probably shouldn't be output when the theme-picker isn't being used, or the standard JavaScript should remove it.

The idea is that the page loads with the no-js class, then JavaScript removes it. If the document is loaded in an environment where there's no JavaScript, you can style things with no-js (to avoid having items on the page that won't work without JS).

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

Successfully merging a pull request may close this issue.

2 participants