Closed
Bug 768619
Opened 13 years ago
Closed 13 years ago
js-class is added to both body and html element
Categories
(www.mozilla.org :: General, defect)
www.mozilla.org
General
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: icaaq, Assigned: sgarrity)
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:16.0) Gecko/16.0 Firefox/16.0
Build ID: 20120626030539
Steps to reproduce:
1. Press Cmd+N to open a new browser window, then type https://www.mozilla.org/en-US/ in the address bar and press Enter
2. Inspect the element html-element and body-element
Actual results:
Both of them have a js class
Expected results:
Only one of them need a js class
Comment 1•13 years ago
|
||
I think the one on the html element is a remnant from Modernizr. Some templates have class="no-js" hardcoded on the html element, which Modernizr is meant to overwrite with its own classes. But we also have a single line of JavaScript that overwrites that class when JS is enabled even if Modernizr isn't present. The class gets added to the body by the global site.js. True, we don't need both, we just need to decide which one to keep.
And we should decide if there's a use for the no-js class at all. I tend to assume non-JavaScript is the baseline for styling purposes, then hang added styles from the .js class where needed (progressive enhancement FTW!). That means .no-js just isn't necessary, and also means the non-JavaScript default is less specific than the overriding rule with the .js class (specificity FTW!). We should look through our CSS and see if .no-js being used anywhere.
Assignee | ||
Updated•13 years ago
|
Assignee: nobody → steven
Assignee | ||
Comment 2•13 years ago
|
||
Good catch Isac.
Looking at at the base template (https://github.com/mozilla/bedrock/blob/master/templates/base.html), we're adding the 'js' class in two places (once of the root element, and once on the body class), as you suggest.
It was added to the HTML element in the in-line JS in the base.html and base-resp.html templates, and added to the body in the /media/js/site.js file included in those templates.
I've consoloted them and created a pull request. Please review: https://github.com/mozilla/bedrock/pull/207
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Reporter | ||
Comment 3•13 years ago
|
||
Looks good :)
Assignee | ||
Comment 4•13 years ago
|
||
Merged to master.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Comment 5•13 years ago
|
||
Commit pushed to dev at https://github.com/mozilla/bedrock
https://github.com/mozilla/bedrock/commit/d3faa2cda2b2a22c213d055c5e6e4efcd05a41a0
Consolodate duplicate 'no-js' class management
(Bug 768619)
Updated•12 years ago
|
Component: www.mozilla.org → General
Product: Websites → www.mozilla.org
You need to log in
before you can comment on or make changes to this bug.
Description
•