Use modern stylesheet selector (#15962)

feature/default_network_editable
David Walsh 2 years ago committed by GitHub
parent e4798b2536
commit 24a3156a2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      shared/lib/switch-direction.js

@ -9,10 +9,9 @@ const switchDirection = async (direction) => {
// eslint-disable-next-line no-param-reassign
direction = 'ltr';
}
let updatedLink;
Array.from(document.getElementsByTagName('link'))
.filter((link) => link.rel === 'stylesheet')
.forEach((link) => {
[...document.querySelectorAll('link[rel=stylesheet]')].forEach((link) => {
if (link.title === direction && link.disabled) {
link.disabled = false;
updatedLink = link;
@ -20,6 +19,7 @@ const switchDirection = async (direction) => {
link.disabled = true;
}
});
if (updatedLink) {
return new Promise((resolve, reject) => {
updatedLink.onload = () => {

Loading…
Cancel
Save