Skip to content

Commit

Permalink
refactor: remove JavaScript detection
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
knowler committed Dec 30, 2021
1 parent f1adf08 commit 405f8d2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion index.php
Expand Up @@ -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'); ?>

Expand Down
6 changes: 2 additions & 4 deletions resources/scripts/app.js
@@ -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.
});

/**
Expand Down

0 comments on commit 405f8d2

Please sign in to comment.