debian-mirror-gitlab/app/assets/javascripts/behaviors/load_startup_css.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
542 B
JavaScript
Raw Normal View History

2021-01-03 14:25:43 +05:30
export const loadStartupCSS = () => {
// We need to fallback to dispatching `load` in case our event listener was added too late
// or the browser environment doesn't load media=print.
// Do this on `window.load` so that the default deferred behavior takes precedence.
// https://gitlab.com/gitlab-org/gitlab/-/issues/239357
window.addEventListener(
'load',
() => {
document
.querySelectorAll('link[media=print]')
2021-03-08 18:12:59 +05:30
.forEach((x) => x.dispatchEvent(new Event('load')));
2021-01-03 14:25:43 +05:30
},
{ once: true },
);
};