Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
html.js .whatever
is overqualified. .js whatever
is just as efficient, so we should just use that.
Instead of doing this separately by module, I think it would be easier to do it all at once.
Comment | File | Size | Author |
---|---|---|---|
#26 | 1269586-25.patch | 7.84 KB | ericduran |
#3 | html.js_.patch | 9.86 KB | Everett Zufelt |
Comments
Comment #1
Everett Zufelt CreditAttribution: Everett Zufelt commented@Jacine
Do you have any idea why html.js was used in the first place?
Other than modifying the following (8.x) does anything need to be done to theme functions / templates to put this in place?
modules/book/book.css:html.js #edit-book-pick-book {
modules/color/color-rtl.css:html.js #preview {
modules/color/color.css:html.js #preview {
modules/contextual/contextual.css:html.js div.contextual-links-wrapper {
modules/openid/openid-rtl.css:html.js #user-login-form li.openid-link,
modules/openid/openid-rtl.css:html.js #user-login li.openid-link {
modules/openid/openid.css:html.js #user-login-form div.form-item-openid-identifier,
modules/openid/openid.css:html.js #user-login div.form-item-openid-identifier {
modules/openid/openid.css:html.js #user-login-form li.openid-link,
modules/openid/openid.css:html.js #user-login li.openid-link {
modules/overlay/overlay-child.css:html.js {
modules/overlay/overlay-child.css:html.js body {
modules/system/system.base-rtl.css:html.js input.form-autocomplete {
modules/system/system.base-rtl.css:html.js input.throbbing {
modules/system/system.base.css:html.js input.form-autocomplete {
modules/system/system.base.css:html.js input.throbbing {
modules/system/system.base.css:html.js fieldset.collapsed {
modules/system/system.base.css:html.js fieldset.collapsed .fieldset-wrapper {
modules/system/system.base.css:html.js .js-hide {
modules/system/system.theme-rtl.css:html.js fieldset.collapsible .fieldset-legend {
modules/system/system.theme-rtl.css:html.js fieldset.collapsed .fieldset-legend {
modules/system/system.theme.css:html.js fieldset.collapsible .fieldset-legend {
modules/system/system.theme.css:html.js fieldset.collapsed .fieldset-legend {
themes/bartik/color/preview.css:html.js #preview {
themes/bartik/css/style-rtl.css:html.js input.form-autocomplete {
themes/bartik/css/style-rtl.css:html.js input.throbbing {
themes/bartik/css/style.css:html.js input.form-autocomplete {
themes/bartik/css/style.css:html.js input.throbbing {
themes/garland/fix-ie-rtl.css:html.js fieldset.collapsible {
themes/garland/fix-ie-rtl.css:html.js fieldset.collapsed {
themes/garland/fix-ie.css:html.js fieldset.collapsible {
themes/garland/fix-ie.css:html.js fieldset.collapsed {
themes/garland/style-rtl.css:html.js fieldset.collapsible .fieldset-legend {
themes/garland/style-rtl.css:html.js fieldset.collapsed .fieldset-legend {
themes/garland/style.css:html.js fieldset.collapsed {
themes/garland/style.css:html.js fieldset.collapsible .fieldset-legend {
themes/garland/style.css:html.js fieldset.collapsed .fieldset-legend {
themes/seven/style.css:html.js fieldset.collapsed {
themes/seven/style.css:html.js input.form-autocomplete {
themes/seven/style.css:html.js input.throbbing {
Comment #2
JacineNo, nothing special needs to be done to make this change. The
.js
is added to the<html>
tag with JavaScript. It's just a nice helper class that let's us know that JavaScript is enabled, and style for JS enabled vs. non-JS enabled circumstances.I think that it was probably written as
html.js
out of habit, maybe so that it's immediately apparent the it's located on the<html>
tag. The same thing is done often in core CSS files, such as usingdiv.selector
. Sometimes it's needed, but most of the time it's not. In this case it's definitely not needed, and the making the patch could be a simple find and replace in CSS files.Comment #3
Everett Zufelt CreditAttribution: Everett Zufelt commentedComment #4
Damien Tournoud CreditAttribution: Damien Tournoud commentedI don't see how
html.js
is overqualified. It makes clear what it is, and avoid possible confusion if/when the same class is used elsewhere then inhtml
. If there is no more rationale then ".js is just as efficient, let's do the change for the sake of it", I would recommend against it.Comment #5
JacineIt's overqualified from a CSS specificity standpoint. Using the html element along with the js class gives it a higher specificity, for no reason, so I'm not sure would you recommend against this.
Comment #6
idflood CreditAttribution: idflood commentedI think this patch should be committed. I see 3 reasons:
I have to agree that the two last can be seen as really minor or not important at all. But if later we decide to put the "js" class on the body tag for any good reason there will be no change needed in the css.
Comment #7
Dave ReidNot sure what this has to do with html5.
Comment #8
Damien Tournoud CreditAttribution: Damien Tournoud commentedYeah, right ;)
I still see no valid reason for this change. Changing anything just for the sake of changing it is just a bad idea.
Comment #9
mortendk CreditAttribution: mortendk commented@dave well now that were changing markup & css all around drupal to make it clean "HTML5" (the magick buzzword)
then it woudn't make sense not to clean up the frontend where we can now were at it?
if we dont look at the markup & classes as a whole then were doing it wrong
Comment #10
mortendk CreditAttribution: mortendk commentedActually its valid not having eather the html or body tag - cause the browser knows it should be there - its crap for accessability though ;)
But the point here is that what frontend developers really really want is as little pre loaded weight as possible. the drupal way used to be to have tons of helpers "because then the themers might can use it" well were actually asking for as little weight as possible to get the job done.
if we follow the idea of not having legacy code, then we should really start to ask why does this helper class need a html.js and not just the .js
Comment #11
JacineDamien, why do you keep saying this is a change just for the sake of it? The valid reason for this and the only reason is taming the CSS specificity. If you don't agree with the change (and I really don't get why, because we are really trying to clean up core CSS here for front end developers) that's one thing, but to continuously say there is no valid reason and mock people in the process is just wrong. And for the record, not that it's something that would ever be recommended, but @idflood is correct in saying that HTML and BODY tags are NOT required, but that's neither here nor there.
Comment #12
dcmouyard CreditAttribution: dcmouyard commented+1 on Everett’s patch in #3. Can we RTBC this yet?
@mortendk What is crap for accessibility?
Comment #13
droplet CreditAttribution: droplet commentedIts inherited, html.js at very top level, so html.js & .js almost same thing.
Needs a reroll.
Comment #14
Damien Tournoud CreditAttribution: Damien Tournoud commented@jacine:
That's a common misconception. HTML and BODY are not required in the HTML source. But they *are* reconstructed by the browser when building the DOM.
Comment #15
Everett Zufelt CreditAttribution: Everett Zufelt commented#3: html.js_.patch queued for re-testing.
Comment #17
dcrocks CreditAttribution: dcrocks commentedJust a note that doesn't add much to this discussion: modernizr also adds a 'js' tag to the html element, so if you are using that code you carry two 'js' tags on the html element with your drupal pages. I've never seen code based on modernizr that uses anything but a simple .js selector.
Comment #18
JacineDon't need this aggravation.
Comment #19
JacineA misconception by who? I know all about that. We were not talking about how browsers build the DOM, we are talking about what markup authors need to have for a valid HTML document. You are just picking fights here for no reason and trying to block a simple change that hurts no one, which is your prerogative, so have fun, but I don't have to deal with it.
/unsubscribe.
Comment #20
ericduran CreditAttribution: ericduran commentedI'm actually re-opening this issue.
For a couple of very simple reasons having nothing to do with, html5, browser magic, or not needing .
The extra specificity is completely pointless!! Is just simply not needed to begin with especially when being used in the way it's currently being used.
That being said the above patch needs work.
Comment #21
ericduran CreditAttribution: ericduran commented#3: html.js_.patch queued for re-testing.
Comment #23
ericduran CreditAttribution: ericduran commentedOh, this needs a re-roll because of the core directories.
Comment #24
droplet CreditAttribution: droplet commentedI think the main purpose of .js class is tell browsers: It is JS enabled..we do something differently" (GLOBALLY, not just for HTML tag). Removing HTML tag or whatever, some of Drupal features may broken. It's another issue.
If not, we should do something like this at beginning...
Comment #25
ericduran CreditAttribution: ericduran commentedThe .js class is only use to style or do things differently with css, or to hide things. That's about all.
The .js class does belong in the html. This issue is not related to that.
This is strictly about removing the html.js declaration in the css to a more simpler and less specific .js.
Comment #26
ericduran CreditAttribution: ericduran commented- won't break anything.
- allows themer to stop using html.js when they really don't want to.
Comment #27
droplet CreditAttribution: droplet commentedLooks good to me.
Comment #28
Dries CreditAttribution: Dries commentedCommitted to 8.x.