node-html-parser 6.1.9 → 6.1.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/CHANGELOG.md +16 -0
- package/README.md +2 -2
- package/dist/main.js +4 -6
- package/dist/nodes/html.d.ts +1 -1
- package/dist/nodes/html.js +4 -6
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
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.11](https://github.com/taoqf/node-fast-html-parser/compare/v6.1.10...v6.1.11) (2023-10-25)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* [#254](https://github.com/taoqf/node-fast-html-parser/issues/254) ([8e4e9e0](https://github.com/taoqf/node-fast-html-parser/commit/8e4e9e0a13796ed9a39ebb930b0ee5e55b578b82))
|
|
11
|
+
* Fixed typo in JSDoc for HTMLElement `structure` method ([3a52ee9](https://github.com/taoqf/node-fast-html-parser/commit/3a52ee97463d8ab1f35ef7c0f08d3696bc38e5c4))
|
|
12
|
+
|
|
13
|
+
### [6.1.10](https://github.com/taoqf/node-fast-html-parser/compare/v6.1.9...v6.1.10) (2023-09-15)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* [#242](https://github.com/taoqf/node-fast-html-parser/issues/242) ([36670f4](https://github.com/taoqf/node-fast-html-parser/commit/36670f4bb15f18b3cdfec0484f67c4cb891f1e79))
|
|
19
|
+
* [#251](https://github.com/taoqf/node-fast-html-parser/issues/251) ([42365de](https://github.com/taoqf/node-fast-html-parser/commit/42365dee6b28da5ab4017508b1ba15be503f001e))
|
|
20
|
+
|
|
5
21
|
### [6.1.9](https://github.com/taoqf/node-fast-html-parser/compare/v6.1.8...v6.1.9) (2023-09-11)
|
|
6
22
|
|
|
7
23
|
|
package/README.md
CHANGED
|
@@ -115,7 +115,7 @@ class HTMLElement{
|
|
|
115
115
|
Node appendChild(Node node)
|
|
116
116
|
this insertAdjacentHTML('beforebegin' | 'afterbegin' | 'beforeend' | 'afterend' where, string html)
|
|
117
117
|
this setAttribute(string key, string value)
|
|
118
|
-
this setAttributes(Record
|
|
118
|
+
this setAttributes(Record string, string attrs)
|
|
119
119
|
this removeAttribute(string key)
|
|
120
120
|
string getAttribute(string key)
|
|
121
121
|
this exchangeChild(Node oldNode, Node newNode)
|
|
@@ -143,7 +143,7 @@ class HTMLElement{
|
|
|
143
143
|
string innerHTML
|
|
144
144
|
string outerHTML
|
|
145
145
|
string textContent
|
|
146
|
-
Record
|
|
146
|
+
Record<string, string> attributes
|
|
147
147
|
[number, number] range
|
|
148
148
|
}
|
|
149
149
|
class Node{
|
package/dist/main.js
CHANGED
|
@@ -592,7 +592,7 @@ define("nodes/html", ["require", "exports", "css-select", "he", "back", "matcher
|
|
|
592
592
|
*/
|
|
593
593
|
get: function () {
|
|
594
594
|
// https://github.com/taoqf/node-html-parser/issues/249
|
|
595
|
-
if (
|
|
595
|
+
if (/^br$/i.test(this.rawTagName)) {
|
|
596
596
|
return '\n';
|
|
597
597
|
}
|
|
598
598
|
return this.childNodes.reduce(function (pre, cur) {
|
|
@@ -772,7 +772,7 @@ define("nodes/html", ["require", "exports", "css-select", "he", "back", "matcher
|
|
|
772
772
|
Object.defineProperty(HTMLElement.prototype, "structure", {
|
|
773
773
|
/**
|
|
774
774
|
* Get DOM structure
|
|
775
|
-
* @return {string}
|
|
775
|
+
* @return {string} structure
|
|
776
776
|
*/
|
|
777
777
|
get: function () {
|
|
778
778
|
var res = [];
|
|
@@ -1355,11 +1355,9 @@ define("nodes/html", ["require", "exports", "css-select", "he", "back", "matcher
|
|
|
1355
1355
|
style: true,
|
|
1356
1356
|
pre: true,
|
|
1357
1357
|
};
|
|
1358
|
-
var element_names = Object.keys(elements)
|
|
1359
|
-
return Boolean(elements[name]);
|
|
1360
|
-
});
|
|
1358
|
+
var element_names = Object.keys(elements);
|
|
1361
1359
|
var kBlockTextElements = element_names.map(function (it) { return new RegExp("^".concat(it, "$"), 'i'); });
|
|
1362
|
-
var kIgnoreElements = element_names.filter(function (it) { return elements[it]; }).map(function (it) { return new RegExp("^".concat(it, "$"), 'i'); });
|
|
1360
|
+
var kIgnoreElements = element_names.filter(function (it) { return Boolean(elements[it]); }).map(function (it) { return new RegExp("^".concat(it, "$"), 'i'); });
|
|
1363
1361
|
function element_should_be_ignore(tag) {
|
|
1364
1362
|
return kIgnoreElements.some(function (it) { return it.test(tag); });
|
|
1365
1363
|
}
|
package/dist/nodes/html.d.ts
CHANGED
package/dist/nodes/html.js
CHANGED
|
@@ -258,7 +258,7 @@ var HTMLElement = /** @class */ (function (_super) {
|
|
|
258
258
|
*/
|
|
259
259
|
get: function () {
|
|
260
260
|
// https://github.com/taoqf/node-html-parser/issues/249
|
|
261
|
-
if (
|
|
261
|
+
if (/^br$/i.test(this.rawTagName)) {
|
|
262
262
|
return '\n';
|
|
263
263
|
}
|
|
264
264
|
return this.childNodes.reduce(function (pre, cur) {
|
|
@@ -438,7 +438,7 @@ var HTMLElement = /** @class */ (function (_super) {
|
|
|
438
438
|
Object.defineProperty(HTMLElement.prototype, "structure", {
|
|
439
439
|
/**
|
|
440
440
|
* Get DOM structure
|
|
441
|
-
* @return {string}
|
|
441
|
+
* @return {string} structure
|
|
442
442
|
*/
|
|
443
443
|
get: function () {
|
|
444
444
|
var res = [];
|
|
@@ -1021,11 +1021,9 @@ function base_parse(data, options) {
|
|
|
1021
1021
|
style: true,
|
|
1022
1022
|
pre: true,
|
|
1023
1023
|
};
|
|
1024
|
-
var element_names = Object.keys(elements)
|
|
1025
|
-
return Boolean(elements[name]);
|
|
1026
|
-
});
|
|
1024
|
+
var element_names = Object.keys(elements);
|
|
1027
1025
|
var kBlockTextElements = element_names.map(function (it) { return new RegExp("^".concat(it, "$"), 'i'); });
|
|
1028
|
-
var kIgnoreElements = element_names.filter(function (it) { return elements[it]; }).map(function (it) { return new RegExp("^".concat(it, "$"), 'i'); });
|
|
1026
|
+
var kIgnoreElements = element_names.filter(function (it) { return Boolean(elements[it]); }).map(function (it) { return new RegExp("^".concat(it, "$"), 'i'); });
|
|
1029
1027
|
function element_should_be_ignore(tag) {
|
|
1030
1028
|
return kIgnoreElements.some(function (it) { return it.test(tag); });
|
|
1031
1029
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-html-parser",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.11",
|
|
4
4
|
"description": "A very fast HTML parser, generating a simplified DOM, with basic element query support.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"reset": "yarn run clean:global && yarn install && yarn build",
|
|
23
23
|
"--------------- ": "",
|
|
24
24
|
"test:target": "mocha --recursive \"./test/tests\"",
|
|
25
|
-
"test:ci": "cross-env TEST_TARGET=dist yarn run test:target",
|
|
25
|
+
"test:ci": "cd test && yarn install && cd .. && cross-env TEST_TARGET=dist yarn run test:target",
|
|
26
26
|
"posttest": "yarn run benchmark",
|
|
27
|
-
"prepare": "
|
|
27
|
+
"prepare": "npm run build",
|
|
28
28
|
"release": "standard-version && git push --follow-tags origin main"
|
|
29
29
|
},
|
|
30
30
|
"keywords": [
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"@typescript-eslint/eslint-plugin-tslint": "latest",
|
|
61
61
|
"@typescript-eslint/parser": "latest",
|
|
62
62
|
"blanket": "latest",
|
|
63
|
+
"boolbase": "^1.0.0",
|
|
63
64
|
"cheerio": "^1.0.0-rc.12",
|
|
64
65
|
"cross-env": "^7.0.3",
|
|
65
66
|
"eslint": "^8.23.1",
|