reffy 20.0.10 → 20.0.11

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": "20.0.10",
3
+ "version": "20.0.11",
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",
@@ -39,7 +39,7 @@
39
39
  "fetch-filecache-for-crawling": "5.1.1",
40
40
  "puppeteer": "24.37.3",
41
41
  "semver": "^7.3.5",
42
- "web-specs": "3.78.1",
42
+ "web-specs": "3.79.0",
43
43
  "webidl2": "24.5.0"
44
44
  },
45
45
  "devDependencies": {
@@ -72,45 +72,6 @@ export default function (spec) {
72
72
 
73
73
  let events = [];
74
74
 
75
- // Look for definitions in event-definition tables
76
- // (used in Pointer Events and UI Events)
77
- [...document.querySelectorAll('table.event-definition')].forEach(table => {
78
- const properties = [...table.querySelectorAll('tr')]
79
- .map(line => {
80
- const nameEl = line.querySelector('th');
81
- const valueEl = line.querySelector('td');
82
- if (!nameEl || !valueEl) {
83
- return null;
84
- }
85
- let name = nameEl.textContent.trim().toLowerCase();
86
- let value = valueEl.textContent.trim();
87
- if (name === 'trusted targets') {
88
- name = 'targets';
89
- value = value.split(',').map(v => v.trim());
90
- }
91
- if (['type', 'interface', 'targets'].includes(name)) {
92
- return { name, value };
93
- }
94
- else if (['bubbles', 'cancelable'].includes(name)) {
95
- return { name, value: value.toLowerCase() === 'yes' ? true : false };
96
- }
97
- else {
98
- return null;
99
- }
100
- })
101
- .filter(prop => !!prop);
102
- const event = {};
103
- for (const prop of properties) {
104
- event[prop.name] = prop.value;
105
- }
106
- event.src = {
107
- format: 'event table',
108
- href: href(table.closest('*[id]'))
109
- },
110
- events.push(event);
111
- });
112
-
113
-
114
75
  // Look for event summary tables
115
76
  // ignore DOM spec which uses a matching table format
116
77
  // to map to legacy event types
@@ -205,6 +166,50 @@ export default function (spec) {
205
166
  }
206
167
  });
207
168
  }
169
+
170
+ // Look for definitions in event-definition tables
171
+ // (used in Pointer Events and UI Events)
172
+ [...document.querySelectorAll('table.event-definition')].forEach(table => {
173
+ const properties = [...table.querySelectorAll('tr')]
174
+ .map(line => {
175
+ const nameEl = line.querySelector('th');
176
+ const valueEl = line.querySelector('td');
177
+ if (!nameEl || !valueEl) {
178
+ return null;
179
+ }
180
+ let name = nameEl.textContent.trim().toLowerCase();
181
+ let value = valueEl.textContent.trim();
182
+ if (name === 'trusted targets') {
183
+ name = 'targets';
184
+ value = value.split(',').map(v => v.trim());
185
+ }
186
+ if (['type', 'interface', 'targets'].includes(name)) {
187
+ return { name, value };
188
+ }
189
+ else if (['bubbles', 'cancelable'].includes(name)) {
190
+ return { name, value: value.toLowerCase() === 'yes' ? true : false };
191
+ }
192
+ else {
193
+ return null;
194
+ }
195
+ })
196
+ .filter(prop => !!prop);
197
+ const event = {};
198
+ for (const prop of properties) {
199
+ event[prop.name] = prop.value;
200
+ }
201
+ event.src = {
202
+ format: 'event table',
203
+ href: href(table.closest('*[id]'))
204
+ };
205
+ // Prefer summary table to definition in an event table if both exist
206
+ // because the latter may include prose around the interface and target
207
+ // names that make it harder to extract meaningful values.
208
+ if (!events.find(e => isSameEvent(e, event))) {
209
+ events.push(event);
210
+ }
211
+ });
212
+
208
213
  // Look for the DOM-suggested sentence "Fire an event named X"
209
214
  // or the Service Worker extension of "fire (a) functional event named"
210
215
  const isFiringLink = a => a.href === "https://dom.spec.whatwg.org/#concept-event-fire" ||