Last modified: 2013-09-04 11:49:45 UTC
Add a class to the HTML element to identify clients that have Javascript on would aid developers in hiding things that are Javascript only and do not have a fallback, without having to add them via Javascript. Example: .client-nojs #someThing { display: none } Would hide the #someThing element from showing when Javascript was off, and .client-js #gizmo { color: blue; Would set #gizmo to have a blue text color when javascript was on
Created attachment 8956 [details] Added feature
I was worried this could lead to some style flicker, but since we seem to have put the page startup module very early on now there's nothing to render yet at the time we change the class. Probably ok then. :D
Committed for trunk/1.19 in r95318.
This is now causing MediaWiki-generated HTML pages to fail the W3C validator, because html apparently is not allowed to have a class. See [[WP:VPT#There is no attribute "class"]]. Could these classes perhaps be put in <body> instead?
(In reply to comment #4) > This is now causing MediaWiki-generated HTML pages to fail the W3C validator, > because html apparently is not allowed to have a class. See [[WP:VPT#There is > no attribute "class"]]. Could these classes perhaps be put in <body> instead? Classes are allowed on the HTML element as of HTML5 as far as I know. Besides, the specification is only important as far as it does not contrast reality. The reality is that all browsers support it in HTML4 as well and it's in the specification as of HTML5.
Does it provide a benefit there over being at body?
(In reply to comment #6) > Does it provide a benefit there over being at body? Not that I can think of. I went from the assumption we'd have the compatibility issue just like with moving the other classes 'off' of <body>. But it looks like this was added relatively recently (ie: not in 1.18). So, go ahead and change it. But do it now, and do it quickly, before 1.19 gets branched and the argument becomes "Is breaking compatibility worth moving the class from <html> to <body> simply to put it with the rest of the classes?".
Done in r103856
Nope reverted, <body> isn't available at that point.