Merge pull request #6831 from MTRNord/patch-8

Fix Tinter.setTheme to not fire using Firefox
This commit is contained in:
Travis Ralston 2018-10-12 13:55:43 -06:00 committed by GitHub
commit 47ade14e07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -289,12 +289,23 @@ async function loadApp() {
// in case the Tinter.tint() in MatrixChat fires before the // in case the Tinter.tint() in MatrixChat fires before the
// CSS has actually loaded (which in practice happens)... // CSS has actually loaded (which in practice happens)...
// FIXME: we should probably block loading the app or even // This if fixes Tinter.setTheme to not fire on Firefox
// showing a spinner until the theme is loaded, to avoid // in case it is the first time loading Riot.
// flashes of unstyled content. // `InstallTrigger` is a Object which only exists on Firefox
a.onload = () => { // (it is used for their Plugins) and can be used as a
// feature check.
// Firefox loads css always before js. This is why we dont use
// onload or it's EventListener as thoose will never trigger.
if (typeof InstallTrigger !== 'undefined') {
Tinter.setTheme(theme); Tinter.setTheme(theme);
}; } else {
// FIXME: we should probably block loading the app or even
// showing a spinner until the theme is loaded, to avoid
// flashes of unstyled content.
a.onload = () => {
Tinter.setTheme(theme);
};
}
} else { } else {
// Firefox requires this to not be done via `setAttribute` // Firefox requires this to not be done via `setAttribute`
// or via HTML. // or via HTML.