testaro 45.0.7 → 45.0.9
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/testaro/dupAtt.js +8 -6
package/package.json
CHANGED
package/testaro/dupAtt.js
CHANGED
|
@@ -59,13 +59,15 @@ exports.reporter = async (page, withItems) => {
|
|
|
59
59
|
// Remove any escaped quotation marks from it.
|
|
60
60
|
rawPage = rawPage.replace(/\\"|\\'/g, '');
|
|
61
61
|
// Remove any script code from it.
|
|
62
|
-
rawPage = rawPage.replace(/<(
|
|
62
|
+
rawPage = rawPage.replace(/<script(?: [^<>]+)?>.*?<\/script>/g, '');
|
|
63
|
+
rawPage = rawPage.replace(/<script(?: [^<>]+)?>/g, '');
|
|
64
|
+
rawPage = rawPage.replace(/<\/script>/g, '');
|
|
63
65
|
// Remove any comments from it.
|
|
64
66
|
rawPage = rawPage.replace(/<!--.*?-->/g, '');
|
|
65
|
-
// Extract the opening tags of its elements.
|
|
66
|
-
let elements = rawPage.match(/<[a-zA-Z][^<>]
|
|
67
|
-
// Delete their enclosing angle brackets.
|
|
68
|
-
elements = elements.map(element => element.replace(/< ?|
|
|
67
|
+
// Extract the syntactically valid opening tags of its elements.
|
|
68
|
+
let elements = rawPage.match(/<[a-zA-Z]+(?: [^<>]+)?>/g);
|
|
69
|
+
// Delete their enclosing angle brackets and any closing slashes.
|
|
70
|
+
elements = elements.map(element => element.replace(/< ?| ?\/?>/g, ''));
|
|
69
71
|
// Delete the values of any attributes in them.
|
|
70
72
|
const nvElements = elements.map(element => element.replace(/="[^"]*"/g, ''));
|
|
71
73
|
// For each element:
|
|
@@ -111,7 +113,7 @@ exports.reporter = async (page, withItems) => {
|
|
|
111
113
|
location: {
|
|
112
114
|
doc: item.id ? 'source' : '',
|
|
113
115
|
type: item.id ? 'selector' : '',
|
|
114
|
-
spec: `#${item.id}`
|
|
116
|
+
spec: item.id ? `#${item.id}` : ''
|
|
115
117
|
},
|
|
116
118
|
excerpt: item.duplicatedAttribute
|
|
117
119
|
});
|