jquery / jquery-wp-content

WordPress themes and plugins for the jQuery sites
GNU General Public License v2.0
253 stars 169 forks source link

jquery: Add the `js` class, remove the `no-js` one #457

Closed mgol closed 6 months ago

mgol commented 6 months ago

This used to be done by Modernizr until its removal in 08f27c14ffc14c158b25e190cfa00125fb79c0d3. Some sites apply different styling for JS-disabled environments; one such example is the jQuery UI Download Builder which expands all Themeroller knobs sections in the no-JS mode.

Krinkle commented 6 months ago

Could we place it outside the dom-ready handler to avoid FOUC/CSS reflow?

timmywil commented 6 months ago

Agreed. This should as early as possible and blocking, which is how modernizr does it.

mgol commented 6 months ago

I guess it doesn't hurt as documentElement is always available.

mgol commented 6 months ago

@Krinkle @timmywil PR updated

timmywil commented 6 months ago

Ok, I was thinking an inline script before jQuery loaded, but this works since we're not loading jQuery async.

mgol commented 6 months ago

I'm not a fan of inline scripts as they don't play nice with CSP if we ever introduce one and I didn't really want to introduce another file just for this.

timmywil commented 6 months ago

ah, right, and we do plan on adding CSP