Skip to content
Snippets Groups Projects
Commit c94c04a9 authored by Fredrik Jonsson's avatar Fredrik Jonsson
Browse files

Run the no-js to js class switch as early as possible.

parent fe38f793
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
'use strict'; 'use strict';
// Replace no-js with js class if js is enabled.
document.querySelector('html').classList.replace('no-js', 'js');
let Search = class { let Search = class {
static selector() { static selector() {
return '.js-search-toggle'; return '.js-search-toggle';
...@@ -104,9 +107,6 @@ ...@@ -104,9 +107,6 @@
} }
}; };
// Replace no-js with js class if js is enabled.
document.querySelector('html').classList.replace('no-js', 'js');
$(MobileMenu.selector()).each((index, el) => { $(MobileMenu.selector()).each((index, el) => {
new MobileMenu($(el), $('.js-mobile-menu-close'), $('.header__menus--mobile'), $('.header__search')); new MobileMenu($(el), $('.js-mobile-menu-close'), $('.header__menus--mobile'), $('.header__search'));
}); });
...@@ -155,4 +155,5 @@ ...@@ -155,4 +155,5 @@
const adminbarHeight = $('.admin-bar').outerHeight(); const adminbarHeight = $('.admin-bar').outerHeight();
document.documentElement.style.setProperty('--header-admin-height', headerHeight + adminbarHeight + 'px'); document.documentElement.style.setProperty('--header-admin-height', headerHeight + adminbarHeight + 'px');
}); });
})(jQuery); })(jQuery);
...@@ -95,7 +95,7 @@ ol { ...@@ -95,7 +95,7 @@ ol {
.no-js-hidden, .no-js-hidden,
%no-js-hidden { %no-js-hidden {
html.nojs & { html.no-js & {
@extend %is-hidden; @extend %is-hidden;
} }
} }
......
...@@ -89,7 +89,7 @@ ol { ...@@ -89,7 +89,7 @@ ol {
.no-js-hidden, .no-js-hidden,
%no-js-hidden { %no-js-hidden {
html.nojs & { html.no-js & {
@extend %is-hidden; @extend %is-hidden;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment