refactor: remove JavaScript detection (#2916)

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.
This commit is contained in:
Nathan Knowler
2022-01-02 14:12:20 -06:00
committed by GitHub
parent ee889edf16
commit 6523ebccb7
2 changed files with 3 additions and 5 deletions

View File

@@ -6,7 +6,7 @@
<?php wp_head(); ?>
</head>
<body <?php body_class('no-js'); ?>>
<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<?php do_action('get_header'); ?>

View File

@@ -1,12 +1,10 @@
import {domReady} from '@scripts/components';
/**
* Remove `.no-js` from document body
* when DOM has loaded.
* Run the application when the DOM is ready.
*/
domReady(() => {
document.body.classList.contains('no-js') &&
document.body.classList.remove('no-js');
// Application code.
});
/**