testaro 76.2.0 → 76.2.1
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 +1 -1
- package/procs/catalog.js +11 -2
package/package.json
CHANGED
package/procs/catalog.js
CHANGED
|
@@ -65,8 +65,17 @@ exports.getCatalog = async report => {
|
|
|
65
65
|
// Initialize the index of the current heading.
|
|
66
66
|
let headingIndex = '';
|
|
67
67
|
// For each element in the page:
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
// Iterate by numeric index rather than `for...in`. `for...in` over this
|
|
69
|
+
// array also enumerates any enumerable members added to Array.prototype
|
|
70
|
+
// by the TARGET page's own scripts (e.g. legacy MooTools/Prototype-style
|
|
71
|
+
// extensions); `element` then becomes that injected value and the
|
|
72
|
+
// element.closest(...) call below throws "closest is not a function",
|
|
73
|
+
// aborting the entire catalog and the job. The indexed loop sees only
|
|
74
|
+
// real elements. `index` is kept as a string so the catalog keys
|
|
75
|
+
// (cat[index], texts[...].push(index)) are unchanged.
|
|
76
|
+
for (let i = 0; i < elements.length; i++) {
|
|
77
|
+
const index = String(i);
|
|
78
|
+
const element = elements[i];
|
|
70
79
|
// Get its ID and tag name.
|
|
71
80
|
const {id, tagName} = element;
|
|
72
81
|
// Get its start tag.
|