@markuplint/selector 3.6.1 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,7 +47,10 @@ exports.ariaPseudoClass = ariaPseudoClass;
47
47
  function ariaPseudoClassParser(syntax) {
48
48
  const [_query, _version] = syntax.split('|');
49
49
  const query = _query === null || _query === void 0 ? void 0 : _query.replace(/\s+/g, '').toLowerCase();
50
- const version = _version === '1.1' ? '1.1' : '1.2';
50
+ const version = _version !== null && _version !== void 0 ? _version : ml_spec_1.ARIA_RECOMMENDED_VERSION;
51
+ if (!(0, ml_spec_1.validateAriaVersion)(version)) {
52
+ throw new SyntaxError(`Unsupported ARIA version: ${version}`);
53
+ }
51
54
  switch (query) {
52
55
  case 'hasname': {
53
56
  return {
@@ -8,7 +8,7 @@ function ariaRolePseudoClass(specs) {
8
8
  el) => {
9
9
  var _a, _b;
10
10
  const aria = ariaPseudoClassParser(content);
11
- const computed = (0, ml_spec_1.getComputedRole)(specs, el, (_a = aria.version) !== null && _a !== void 0 ? _a : '1.2');
11
+ const computed = (0, ml_spec_1.getComputedRole)(specs, el, (_a = aria.version) !== null && _a !== void 0 ? _a : ml_spec_1.ARIA_RECOMMENDED_VERSION);
12
12
  if (((_b = computed.role) === null || _b === void 0 ? void 0 : _b.name) === aria.role) {
13
13
  return {
14
14
  specificity: [0, 1, 0],
@@ -27,7 +27,10 @@ exports.ariaRolePseudoClass = ariaRolePseudoClass;
27
27
  function ariaPseudoClassParser(syntax) {
28
28
  var _a;
29
29
  const [roleName, _version] = syntax.split('|');
30
- const version = _version === '1.1' ? '1.1' : '1.2';
30
+ const version = _version !== null && _version !== void 0 ? _version : ml_spec_1.ARIA_RECOMMENDED_VERSION;
31
+ if (!(0, ml_spec_1.validateAriaVersion)(version)) {
32
+ throw new SyntaxError(`Unsupported ARIA version: ${version}`);
33
+ }
31
34
  return {
32
35
  role: (_a = roleName === null || roleName === void 0 ? void 0 : roleName.trim().toLowerCase()) !== null && _a !== void 0 ? _a : syntax.trim().toLowerCase(),
33
36
  version,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/selector",
3
- "version": "3.6.1",
3
+ "version": "3.7.0",
4
4
  "description": "Extended W3C Selectors matcher",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -20,16 +20,16 @@
20
20
  "clean": "tsc --build --clean"
21
21
  },
22
22
  "dependencies": {
23
+ "@markuplint/ml-spec": "3.7.0",
23
24
  "debug": "^4.3.4",
24
25
  "postcss-selector-parser": "^6.0.11",
25
26
  "tslib": "^2.4.1"
26
27
  },
27
28
  "devDependencies": {
28
- "@markuplint/ml-spec": "3.6.1",
29
29
  "@types/debug": "^4.1.7",
30
30
  "@types/jsdom": "16",
31
31
  "jsdom": "19",
32
32
  "type-fest": "^3.6.1"
33
33
  },
34
- "gitHead": "3cdf5a088b2da03773d5d4461d0e65ec32290a00"
34
+ "gitHead": "42b97b47d22b37437024e693a72a458e2963e261"
35
35
  }