reffy 18.8.0 → 18.8.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reffy",
3
- "version": "18.8.0",
3
+ "version": "18.8.2",
4
4
  "description": "W3C/WHATWG spec dependencies exploration companion. Features a short set of tools to study spec references as well as WebIDL term definitions and references found in W3C specifications.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -45,7 +45,7 @@
45
45
  "devDependencies": {
46
46
  "respec": "35.4.0",
47
47
  "respec-hljs": "2.1.1",
48
- "rollup": "4.41.1",
48
+ "rollup": "4.42.0",
49
49
  "undici": "^7.0.0"
50
50
  },
51
51
  "overrides": {
@@ -308,16 +308,37 @@ export default function () {
308
308
 
309
309
  // Specs typically do not make the syntax of selectors such as `:visited`
310
310
  // explicit because it essentially goes without saying: the syntax is the
311
- // selector's name itself. Note that the syntax of selectors that are
312
- // function-like such as `:nth-child()` cannot be inferred in the same way.
313
- for (const selector of res.selectors) {
314
- if (!selector.value && !selector.name.match(/\(/)) {
311
+ // selector's name itself. One nuance is that, for combinators such as `||`,
312
+ // tokens needs to be enclosed in single-quotes for the syntax to be valid.
313
+ // Note the syntax of selectors that are function-like such as `:nth-child()`
314
+ // cannot be inferred in the same way.
315
+ function setValueFromName(selector) {
316
+ if (selector.value) {
317
+ return;
318
+ }
319
+ if (selector.name.match(/\(/)) {
320
+ // Function-like selector
321
+ return;
322
+ }
323
+ if (selector.name.match(/^[:a-z]/i)) {
324
+ // Keyword-like selector that is not a combinator
315
325
  selector.value = selector.name;
316
326
  }
317
- for (const subSelector of selector.values ?? []) {
318
- if (!subSelector.value && !subSelector.name.match(/\(/)) {
319
- subSelector.value = subSelector.name;
327
+ else {
328
+ // Combinator, let's enclose tokens in single-quotes
329
+ const tokens = selector.name.split('');
330
+ if (tokens.length === 1) {
331
+ selector.value = `'${tokens[0]}'`;
320
332
  }
333
+ else {
334
+ selector.value = tokens.map(token => `'${token}'`).join(' ');
335
+ }
336
+ }
337
+ }
338
+ for (const selector of res.selectors) {
339
+ setValueFromName(selector);
340
+ for (const subSelector of selector.values ?? []) {
341
+ setValueFromName(subSelector);
321
342
  }
322
343
  }
323
344