From 648b295ef2f23bb9a66bf318849d01d75a82fc0a Mon Sep 17 00:00:00 2001 From: tophf Date: Sat, 12 Feb 2022 01:18:03 +0300 Subject: [PATCH] parserlib: handle layer statements anywhere --- js/csslint/parserlib.js | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/js/csslint/parserlib.js b/js/csslint/parserlib.js index 5e103778..63b5ae31 100644 --- a/js/csslint/parserlib.js +++ b/js/csslint/parserlib.js @@ -3478,7 +3478,10 @@ self.parserlib = (() => { } if ((val = t.value) === '{') { if (ids[1]) this.fire({type: 'error', message: '@layer block cannot have multiple ids'}, start); - this._layerBlock(start, true, ids[0]); + this.fire({type: 'startlayer', id: ids[0] || null}, start); + this._rulesetBlock(start); + this.fire('endlayer'); + this._ws(); return; } } while (val === ','); @@ -3487,18 +3490,6 @@ self.parserlib = (() => { this._ws(); } - _layerBlock(start, inBlock, id) { - if (!inBlock) { - this._ws(); - id = this._tokenStream.match(Tokens.IDENT); - this._tokenStream.mustMatch(Tokens.LBRACE); - } - this.fire({type: 'startlayer', id: id || null}, start); - this._rulesetBlock(start); - this.fire('endlayer'); - this._ws(); - } - _stylesheet() { const stream = this._tokenStream; this.fire('startstylesheet'); @@ -4586,7 +4577,7 @@ self.parserlib = (() => { [Tokens.DOCUMENT_SYM]: Parser.prototype._documentMisplaced, [Tokens.FONT_FACE_SYM]: Parser.prototype._fontFace, [Tokens.KEYFRAMES_SYM]: Parser.prototype._keyframes, - [Tokens.LAYER_SYM]: Parser.prototype._layerBlock, + [Tokens.LAYER_SYM]: Parser.prototype._layer, [Tokens.MEDIA_SYM]: Parser.prototype._media, [Tokens.PAGE_SYM]: Parser.prototype._page, [Tokens.SUPPORTS_SYM]: Parser.prototype._supports,