transition patch is redundant in Chrome 93+

This commit is contained in:
tophf 2022-03-08 23:38:51 +03:00
parent 619f771b4a
commit 614dce0e8c
3 changed files with 14 additions and 9 deletions

View File

@ -15,7 +15,7 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({
const list = []; const list = [];
const table = new Map(); const table = new Map();
let isEnabled = true; let isEnabled = true;
let isTransitionPatched; let isTransitionPatched = chrome.app && CSS.supports('accent-color', 'red'); // Chrome 93
let exposeStyleName; let exposeStyleName;
// will store the original method refs because the page can override them // will store the original method refs because the page can override them
let creationDoc, createElement, createElementNS; let creationDoc, createElement, createElementNS;

View File

@ -1,8 +1,11 @@
html#stylus #header *:not(#\1transition-suppressor) { @supports not (accent-color: red) {
/* This suppresses a bug in all? browsers: they apply transitions during page load. /* This suppresses a bug in all? browsers: they apply transitions during page load.
* It was fixed by crrev.com/886802 in Chrome 93, which we detect via `accent-color`.
* Using an increased specificity to override sane selectors in user styles. * Using an increased specificity to override sane selectors in user styles.
* Using \1 to simplify js code because \0 is converted to \xFFFD per spec. */ * Using \1 to simplify js code because \0 is converted to \xFFFD per spec. */
transition: none !important; html#stylus #header *:not(#\1transition-suppressor) {
transition: none !important;
}
} }
:root { :root {
--family: Arial, "Helvetica Neue", Helvetica, system-ui, sans-serif; --family: Arial, "Helvetica Neue", Helvetica, system-ui, sans-serif;

View File

@ -1,5 +1,5 @@
/* global $$ $ $create focusAccessibility getEventKeyName moveFocus */// dom.js /* global $$ $ $create focusAccessibility getEventKeyName moveFocus */// dom.js
/* global clamp debounce */// toolbox.js /* global CHROME clamp debounce */// toolbox.js
/* global msg */ /* global msg */
/* global t */// localization.js /* global t */// localization.js
'use strict'; 'use strict';
@ -24,11 +24,13 @@
} }
}); });
// Removing transition-suppressor rule // Removing transition-suppressor rule
const {sheet} = $('link[href$="global.css"]'); if (!CHROME || CHROME < 93) {
for (let i = 0, rule; (rule = sheet.cssRules[i]); i++) { const {sheet} = $('link[href$="global.css"]');
if (/#\\1\s?transition-suppressor/.test(rule.selectorText)) { for (let i = 0, rule; (rule = sheet.cssRules[i]); i++) {
sheet.deleteRule(i); if (/#\\1\s?transition-suppressor/.test(rule.cssText)) {
break; sheet.deleteRule(i);
break;
}
} }
} }