Skip to content

Commit

Permalink
fix(mobile): reorder stylesheets
Browse files Browse the repository at this point in the history
As we insert other stylesheets after the head (and therefore later than
stylesheets in the head), they take precedence over stylesheets in the
head.

Therefore, we can't insert our device and branding stylesheets in the
end of the <head>. We need to insert them after the latest other
stylesheet.

This appears to a regression from #9442

Signed-off-by: Skyler Grey <skyler.grey@collabora.com>
Change-Id: I829c0dc1ad95a28650845d39aad9f975692319b8
  • Loading branch information
Minion3665 committed Aug 23, 2024
1 parent f60e589 commit 76c255e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions browser/js/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,12 @@ class InitializerBase {
brandingLink.setAttribute("href", this.brandingUriPrefix + theme_prefix + 'branding-desktop.css');
}

document.getElementsByTagName("head")[[0]].appendChild(link);
document.getElementsByTagName("head")[[0]].appendChild(brandingLink);
const otherStylesheets = document.querySelectorAll('link[rel="stylesheet"]');
const lastOtherStylesheet = otherStylesheets[otherStylesheets.length - 1];

lastOtherStylesheet
.insertAdjacentElement('afterend', link)
.insertAdjacentElement('afterend', brandingLink);
}

initializeViewMode() {
Expand Down

0 comments on commit 76c255e

Please sign in to comment.