fix: apply sort directly in injected code

Signed-off-by: Valentin Brajon <vbrajon@gmail.com>
This commit is contained in:
Valentin Brajon 2024-09-05 02:13:13 +02:00 committed by GitHub
parent 255143e201
commit bd3eb0e1e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -74,10 +74,8 @@ export class SelectorEvaluatorImpl implements SelectorEvaluator {
this._engines.set('near', createLayoutEngine('near')); this._engines.set('near', createLayoutEngine('near'));
this._engines.set('nth-match', nthMatchEngine); this._engines.set('nth-match', nthMatchEngine);
const allNames = [...this._engines.keys()]; const allNames = [...this._engines.keys()].sort();
allNames.sort(); const parserNames = [...customCSSNames].sort();
const parserNames = [...customCSSNames];
parserNames.sort();
if (allNames.join('|') !== parserNames.join('|')) if (allNames.join('|') !== parserNames.join('|'))
throw new Error(`Please keep customCSSNames in sync with evaluator engines: ${allNames.join('|')} vs ${parserNames.join('|')}`); throw new Error(`Please keep customCSSNames in sync with evaluator engines: ${allNames.join('|')} vs ${parserNames.join('|')}`);
} }