node-html-parser 6.1.7 → 6.1.8
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/CHANGELOG.md +7 -0
- package/dist/main.js +3 -33
- package/dist/nodes/html.js +1 -31
- package/dist/void-tag.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [6.1.8](https://github.com/taoqf/node-fast-html-parser/compare/v6.1.7...v6.1.8) (2023-09-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* [#248](https://github.com/taoqf/node-fast-html-parser/issues/248) void tag ([01ff9f4](https://github.com/taoqf/node-fast-html-parser/commit/01ff9f41e416d0ef0c47bc40c282d6aeb405e100))
|
|
11
|
+
|
|
5
12
|
### [6.1.7](https://github.com/taoqf/node-fast-html-parser/compare/v6.1.6...v6.1.7) (2023-09-08)
|
|
6
13
|
|
|
7
14
|
|
package/dist/main.js
CHANGED
|
@@ -222,12 +222,12 @@ define("void-tag", ["require", "exports"], function (require, exports) {
|
|
|
222
222
|
this.addClosingSlash = addClosingSlash;
|
|
223
223
|
if (Array.isArray(tags)) {
|
|
224
224
|
this.voidTags = tags.reduce(function (set, tag) {
|
|
225
|
-
return set.add(tag.toLowerCase());
|
|
225
|
+
return set.add(tag.toLowerCase()).add(tag.toUpperCase()).add(tag);
|
|
226
226
|
}, new Set());
|
|
227
227
|
}
|
|
228
228
|
else {
|
|
229
229
|
this.voidTags = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'].reduce(function (set, tag) {
|
|
230
|
-
return set.add(tag);
|
|
230
|
+
return set.add(tag.toLowerCase()).add(tag.toUpperCase()).add(tag);
|
|
231
231
|
}, new Set());
|
|
232
232
|
}
|
|
233
233
|
}
|
|
@@ -1294,36 +1294,6 @@ define("nodes/html", ["require", "exports", "css-select", "he", "back", "matcher
|
|
|
1294
1294
|
// https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
|
|
1295
1295
|
var kMarkupPattern = /<!--[\s\S]*?-->|<(\/?)([a-zA-Z][-.:0-9_a-zA-Z]*)((?:\s+[^>]*?(?:(?:'[^']*')|(?:"[^"]*"))?)*)\s*(\/?)>/g;
|
|
1296
1296
|
var kAttributePattern = /(?:^|\s)(id|class)\s*=\s*((?:'[^']*')|(?:"[^"]*")|\S+)/gi;
|
|
1297
|
-
var kSelfClosingElements = {
|
|
1298
|
-
area: true,
|
|
1299
|
-
AREA: true,
|
|
1300
|
-
base: true,
|
|
1301
|
-
BASE: true,
|
|
1302
|
-
br: true,
|
|
1303
|
-
BR: true,
|
|
1304
|
-
col: true,
|
|
1305
|
-
COL: true,
|
|
1306
|
-
hr: true,
|
|
1307
|
-
HR: true,
|
|
1308
|
-
img: true,
|
|
1309
|
-
IMG: true,
|
|
1310
|
-
input: true,
|
|
1311
|
-
INPUT: true,
|
|
1312
|
-
link: true,
|
|
1313
|
-
LINK: true,
|
|
1314
|
-
meta: true,
|
|
1315
|
-
META: true,
|
|
1316
|
-
source: true,
|
|
1317
|
-
SOURCE: true,
|
|
1318
|
-
embed: true,
|
|
1319
|
-
EMBED: true,
|
|
1320
|
-
param: true,
|
|
1321
|
-
PARAM: true,
|
|
1322
|
-
track: true,
|
|
1323
|
-
TRACK: true,
|
|
1324
|
-
wbr: true,
|
|
1325
|
-
WBR: true,
|
|
1326
|
-
};
|
|
1327
1297
|
var kElementsClosedByOpening = {
|
|
1328
1298
|
li: { li: true, LI: true },
|
|
1329
1299
|
LI: { li: true, LI: true },
|
|
@@ -1490,7 +1460,7 @@ define("nodes/html", ["require", "exports", "css-select", "he", "back", "matcher
|
|
|
1490
1460
|
}
|
|
1491
1461
|
}
|
|
1492
1462
|
// Handle closing tags or self-closed elements (ie </tag> or <br>)
|
|
1493
|
-
if (leadingSlash || closingSlash ||
|
|
1463
|
+
if (leadingSlash || closingSlash || voidTag.isVoidElement(tagName)) {
|
|
1494
1464
|
while (true) {
|
|
1495
1465
|
if (noNestedTagIndex != null && (tagName === 'a' || tagName === 'A'))
|
|
1496
1466
|
noNestedTagIndex = undefined;
|
package/dist/nodes/html.js
CHANGED
|
@@ -960,36 +960,6 @@ exports.default = HTMLElement;
|
|
|
960
960
|
// https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
|
|
961
961
|
var kMarkupPattern = /<!--[\s\S]*?-->|<(\/?)([a-zA-Z][-.:0-9_a-zA-Z]*)((?:\s+[^>]*?(?:(?:'[^']*')|(?:"[^"]*"))?)*)\s*(\/?)>/g;
|
|
962
962
|
var kAttributePattern = /(?:^|\s)(id|class)\s*=\s*((?:'[^']*')|(?:"[^"]*")|\S+)/gi;
|
|
963
|
-
var kSelfClosingElements = {
|
|
964
|
-
area: true,
|
|
965
|
-
AREA: true,
|
|
966
|
-
base: true,
|
|
967
|
-
BASE: true,
|
|
968
|
-
br: true,
|
|
969
|
-
BR: true,
|
|
970
|
-
col: true,
|
|
971
|
-
COL: true,
|
|
972
|
-
hr: true,
|
|
973
|
-
HR: true,
|
|
974
|
-
img: true,
|
|
975
|
-
IMG: true,
|
|
976
|
-
input: true,
|
|
977
|
-
INPUT: true,
|
|
978
|
-
link: true,
|
|
979
|
-
LINK: true,
|
|
980
|
-
meta: true,
|
|
981
|
-
META: true,
|
|
982
|
-
source: true,
|
|
983
|
-
SOURCE: true,
|
|
984
|
-
embed: true,
|
|
985
|
-
EMBED: true,
|
|
986
|
-
param: true,
|
|
987
|
-
PARAM: true,
|
|
988
|
-
track: true,
|
|
989
|
-
TRACK: true,
|
|
990
|
-
wbr: true,
|
|
991
|
-
WBR: true,
|
|
992
|
-
};
|
|
993
963
|
var kElementsClosedByOpening = {
|
|
994
964
|
li: { li: true, LI: true },
|
|
995
965
|
LI: { li: true, LI: true },
|
|
@@ -1156,7 +1126,7 @@ function base_parse(data, options) {
|
|
|
1156
1126
|
}
|
|
1157
1127
|
}
|
|
1158
1128
|
// Handle closing tags or self-closed elements (ie </tag> or <br>)
|
|
1159
|
-
if (leadingSlash || closingSlash ||
|
|
1129
|
+
if (leadingSlash || closingSlash || voidTag.isVoidElement(tagName)) {
|
|
1160
1130
|
while (true) {
|
|
1161
1131
|
if (noNestedTagIndex != null && (tagName === 'a' || tagName === 'A'))
|
|
1162
1132
|
noNestedTagIndex = undefined;
|
package/dist/void-tag.js
CHANGED
|
@@ -6,12 +6,12 @@ var VoidTag = /** @class */ (function () {
|
|
|
6
6
|
this.addClosingSlash = addClosingSlash;
|
|
7
7
|
if (Array.isArray(tags)) {
|
|
8
8
|
this.voidTags = tags.reduce(function (set, tag) {
|
|
9
|
-
return set.add(tag.toLowerCase());
|
|
9
|
+
return set.add(tag.toLowerCase()).add(tag.toUpperCase()).add(tag);
|
|
10
10
|
}, new Set());
|
|
11
11
|
}
|
|
12
12
|
else {
|
|
13
13
|
this.voidTags = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'].reduce(function (set, tag) {
|
|
14
|
-
return set.add(tag);
|
|
14
|
+
return set.add(tag.toLowerCase()).add(tag.toUpperCase()).add(tag);
|
|
15
15
|
}, new Set());
|
|
16
16
|
}
|
|
17
17
|
}
|
package/package.json
CHANGED