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
Remove JavaScript detection using class names #2916
Conversation
I have not tested this. The only thing I think which could go wrong is maybe needing to add WordPress’ Also, adding the |
cb64451
to
5b7326c
Compare
Ok, I’ve tested this and it works. There’s no need to add any deps for the editor script since |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we keep a domReady
example or starting point in app.js
?
latest acorn release is triggering those failures rn, you can ignore (we're gonna just remove php 7.3 support) |
We can do that. We would need to add our |
I vote we add it back and keep it how it was outside of moving |
5b7326c
to
d4a87e6
Compare
I added it back. Should we add it back to |
JavaScript detection with a class name on the body or html element tends to go unused even by websites that have it set up. Instead, we recommend that developers write progressively enhanced components that are styled for non-JS usage by default. Increase specificity, use the cascade, or code split to apply progressively enhanced styles.
d4a87e6
to
405f8d2
Compare
I changed directions here:
|
no-js
on HTML element and remove earlier
This PR took a bit of a turn. Originally, it moved existing JavaScript detection from the
body
to thehtml
element as well as the code to do that to theindex.php
file. After some feedback and further research, I began to question the necessity of the JavaScript detection in the first place. I struggled to find websites that actually used JavaScript detection with a class name onhtml
orbody
and when they did there was no code on the site that actually used the class name for any non-JS or enhanced effect.I’m convinced that this method has lost favour to progressive enhancement methods which emphasize writing styles that work for HTML out of the box. In these methods, increased specificity (e.g. the targeting the presence of attributes) is used to style components when they are enhanced with JavaScript. An example of this in practice might be web components that dynamically import and adopt their stylesheet upon registration. The philosophy here is to allow browsers that want to work less, to do so instead of working more (e.g. writing
.no-js
styles that override fully enhanced component styles).