From 273a6088ad683ffd31078bf14f63ca1002460d8b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Dec 2023 12:57:59 +0000 Subject: [PATCH 1/2] chore: bump css-selector-parser from 1.4.1 to 3.0.2 Bumps [css-selector-parser](https://github.com/mdevils/css-selector-parser) from 1.4.1 to 3.0.2. - [Changelog](https://github.com/mdevils/css-selector-parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/mdevils/css-selector-parser/commits/v3.0.2) --- updated-dependencies: - dependency-name: css-selector-parser dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package-lock.json | 28 +++++++++++++++++++--------- package.json | 2 +- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index ff1ce315df..43d4697fc7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,12 +20,12 @@ "browser-driver-manager": "1.0.4", "chai": "^4.3.7", "chalk": "^4.x", - "chromedriver": "latest", + "chromedriver": "*", "clone": "^2.1.2", "colorjs.io": "^0.4.3", "conventional-commits-parser": "^5.0.0", "core-js": "^3.27.1", - "css-selector-parser": "^1.4.1", + "css-selector-parser": "^3.0.2", "emoji-regex": "^10.2.1", "es6-promise": "^4.2.8", "esbuild": "^0.10.x", @@ -4194,10 +4194,20 @@ } }, "node_modules/css-selector-parser": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/css-selector-parser/-/css-selector-parser-1.4.1.tgz", - "integrity": "sha512-HYPSb7y/Z7BNDCOrakL4raGO2zltZkbeXyAd6Tg9obzix6QhzxCotdBl6VT0Dv4vZfJGVz3WL/xaEI9Ly3ul0g==", - "dev": true + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/css-selector-parser/-/css-selector-parser-3.0.2.tgz", + "integrity": "sha512-eA5pvYwgtffuxQlDk0gJRApDUKgfwlsQBMAH6uawKuuilTLfxKIOtzyV63Y3IC0LWnDCeTJ/I1qYmlfYvvMzDg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/mdevils" + }, + { + "type": "patreon", + "url": "https://patreon.com/mdevils" + } + ] }, "node_modules/css-what": { "version": "6.1.0", @@ -15638,9 +15648,9 @@ } }, "css-selector-parser": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/css-selector-parser/-/css-selector-parser-1.4.1.tgz", - "integrity": "sha512-HYPSb7y/Z7BNDCOrakL4raGO2zltZkbeXyAd6Tg9obzix6QhzxCotdBl6VT0Dv4vZfJGVz3WL/xaEI9Ly3ul0g==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/css-selector-parser/-/css-selector-parser-3.0.2.tgz", + "integrity": "sha512-eA5pvYwgtffuxQlDk0gJRApDUKgfwlsQBMAH6uawKuuilTLfxKIOtzyV63Y3IC0LWnDCeTJ/I1qYmlfYvvMzDg==", "dev": true }, "css-what": { diff --git a/package.json b/package.json index 878bf3d12c..1a29799102 100644 --- a/package.json +++ b/package.json @@ -125,7 +125,7 @@ "colorjs.io": "^0.4.3", "conventional-commits-parser": "^5.0.0", "core-js": "^3.27.1", - "css-selector-parser": "^1.4.1", + "css-selector-parser": "^3.0.2", "emoji-regex": "^10.2.1", "es6-promise": "^4.2.8", "esbuild": "^0.10.x", From 62cb71fba9d152238a7a9210e739f92b3e03aa7d Mon Sep 17 00:00:00 2001 From: Wilco Fiers Date: Mon, 4 Dec 2023 17:31:29 +0100 Subject: [PATCH 2/2] deprecate axe.imports --- lib/core/imports/index.js | 30 ++++++++++++++++++++++++++++-- lib/core/utils/css-parser.js | 22 +++++++++++++++------- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/lib/core/imports/index.js b/lib/core/imports/index.js index 63622d7636..89b2aca239 100644 --- a/lib/core/imports/index.js +++ b/lib/core/imports/index.js @@ -1,4 +1,4 @@ -import { CssSelectorParser } from 'css-selector-parser'; +import { createParser } from 'css-selector-parser'; import doT from '@deque/dot'; import emojiRegexText from 'emoji-regex'; import memoize from 'memoizee'; @@ -40,10 +40,36 @@ if (window.Uint32Array) { } } +/** + * @deprecated + */ +class CSSSelectorParser { + constructor() { + this.parser = createParser({ + syntax: { + pseudoClasses: { + definitions: { + Selector: ['is', 'not'] + } + }, + combinators: ['>'], + attributes: { + operators: ['^=', '$=', '*=', '~='] + } + } + }); + } + + parse(selector) { + return this.parser.parse(selector); + } +} + /** * Namespace `axe.imports` which holds required external dependencies * * @namespace imports + * @deprecated * @memberof axe */ -export { CssSelectorParser, doT, emojiRegexText, memoize, Color as Colorjs }; +export { CSSSelectorParser, doT, emojiRegexText, memoize, Color as Colorjs }; diff --git a/lib/core/utils/css-parser.js b/lib/core/utils/css-parser.js index 355a40236d..0061230a14 100644 --- a/lib/core/utils/css-parser.js +++ b/lib/core/utils/css-parser.js @@ -1,9 +1,17 @@ -import { CssSelectorParser } from 'css-selector-parser'; +import { createParser } from 'css-selector-parser'; -const parser = new CssSelectorParser(); -parser.registerSelectorPseudos('not'); -parser.registerSelectorPseudos('is'); -parser.registerNestingOperators('>'); -parser.registerAttrEqualityMods('^', '$', '*', '~'); +const parse = createParser({ + syntax: { + pseudoClasses: { + definitions: { + Selector: ['is', 'not'] + } + }, + combinators: ['>'], + attributes: { + operators: ['^=', '$=', '*=', '~='] + } + } +}); -export default parser; +export default { parse };