read css escapes per spec
This commit is contained in:
parent
f10ebffeff
commit
0aa6d3b463
|
@ -1,6 +1,7 @@
|
|||
html#stylus #header *:not(#\0transition-suppressor) {
|
||||
html#stylus #header *:not(#\1transition-suppressor) {
|
||||
/* This suppresses a bug in all? browsers: they apply transitions during page load.
|
||||
* 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. */
|
||||
transition: none !important;
|
||||
}
|
||||
body {
|
||||
|
|
|
@ -3014,8 +3014,14 @@ self.parserlib = (() => {
|
|||
}
|
||||
|
||||
readEscape() {
|
||||
const cp = this._reader.readMatch(/[0-9a-f]{1,6}\b\s*/iy);
|
||||
return cp ? String.fromCodePoint(parseInt(cp, 16)) : this._reader.read();
|
||||
let res = this._reader.readMatch(/[0-9a-f]{1,6}\s?/iy);
|
||||
if (res) {
|
||||
res = parseInt(res, 16);
|
||||
res = String.fromCodePoint(res && res <= 0x10FFFF ? res : 0xFFFD);
|
||||
} else {
|
||||
res = this._reader.read();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -440,8 +440,7 @@ async function waitForSheet({
|
|||
window.on('load', () => {
|
||||
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)) {
|
||||
if (/#\\1\s?transition-suppressor/.test(rule.selectorText)) {
|
||||
sheet.deleteRule(i);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ testGlobalCss();
|
|||
function testGlobalCss() {
|
||||
const css = fs.readFileSync('global.css', {encoding: 'utf8'});
|
||||
const ERR = 'global.css: missing the transition suppressor rule';
|
||||
const RX_SUPPRESSOR = /[^{}]+#\\0transition-suppressor[^{}]+{\s*transition:\s*none\s*!\s*important/i;
|
||||
const RX_SUPPRESSOR = /[^{}]+#\\1\s?transition-suppressor[^{}]+{\s*transition:\s*none\s*!\s*important/i;
|
||||
const RX_COMMENT = /\/\*([^*]|\*(?!\/))*(\*\/|$)/g;
|
||||
if (!RX_SUPPRESSOR.test(css.replace(RX_COMMENT, ''))) {
|
||||
console.error(ERR);
|
||||
|
|
Loading…
Reference in New Issue
Block a user