make transition suppressor rule more robust
This commit is contained in:
parent
43f1da1b4c
commit
711f6502b5
|
@ -1,7 +1,6 @@
|
||||||
html#stylus #header *:not(#\0) {
|
html#stylus #header *:not(#\0transition-suppressor) {
|
||||||
/* This suppresses transitions on page open.
|
/* This suppresses a bug in all? browsers: they apply transitions during page load.
|
||||||
* WARNING! Must be the first rule here so dom.js can simply call deleteRule for index 0.
|
* Using an increased specificity to override sane selectors in user styles. */
|
||||||
* Using an increased specificity to override sane selectors in user styles */
|
|
||||||
transition: none !important;
|
transition: none !important;
|
||||||
}
|
}
|
||||||
body {
|
body {
|
||||||
|
|
12
js/dom.js
12
js/dom.js
|
@ -437,8 +437,16 @@ async function waitForSheet({
|
||||||
window.on('resize', () => debounce(addTooltipsToEllipsized, 100));
|
window.on('resize', () => debounce(addTooltipsToEllipsized, 100));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Using `load` event as we need transition bug suppressor active until everything loads
|
window.on('load', () => {
|
||||||
window.on('load', () => $('link[href^="global.css"]').sheet.deleteRule(0), {once: true});
|
const {sheet} = $('link[href^="global.css"]');
|
||||||
|
for (let i = 0, rule; (rule = sheet.cssRules[i]); i++) {
|
||||||
|
// Not using \0 in the id as it's converted to \xFFFD, probably a bug
|
||||||
|
if (/#.transition-suppressor/.test(rule.selectorText)) {
|
||||||
|
sheet.deleteRule(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {once: true});
|
||||||
|
|
||||||
function addFaviconFF() {
|
function addFaviconFF() {
|
||||||
const iconset = ['', 'light/'][prefs.get('iconset')] || '';
|
const iconset = ['', 'light/'][prefs.get('iconset')] || '';
|
||||||
|
|
|
@ -6,8 +6,8 @@ testGlobalCss();
|
||||||
|
|
||||||
function testGlobalCss() {
|
function testGlobalCss() {
|
||||||
const css = fs.readFileSync('global.css', {encoding: 'utf8'});
|
const css = fs.readFileSync('global.css', {encoding: 'utf8'});
|
||||||
const ERR = 'global.css: the first rule must be the transition suppressor';
|
const ERR = 'global.css: missing the transition suppressor rule';
|
||||||
const RX_SUPPRESSOR = /^[^{}]+{\s*transition:\s*none\s*!\s*important/i;
|
const RX_SUPPRESSOR = /[^{}]+#\\0transition-suppressor[^{}]+{\s*transition:\s*none\s*!\s*important/i;
|
||||||
const RX_COMMENT = /\/\*([^*]|\*(?!\/))*(\*\/|$)/g;
|
const RX_COMMENT = /\/\*([^*]|\*(?!\/))*(\*\/|$)/g;
|
||||||
if (!RX_SUPPRESSOR.test(css.replace(RX_COMMENT, ''))) {
|
if (!RX_SUPPRESSOR.test(css.replace(RX_COMMENT, ''))) {
|
||||||
console.error(ERR);
|
console.error(ERR);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user