node-html-parser
Advanced tools
+13
-0
@@ -5,2 +5,15 @@ # Changelog | ||
| ## [8.0.0](https://github.com/taoqf/node-fast-html-parser/compare/v7.1.1...v8.0.0) (2026-06-20) | ||
| ### ⚠ BREAKING CHANGES | ||
| * replace dependences he to entities | ||
| ### Features | ||
| * replace dependences he to entities ([97fe577](https://github.com/taoqf/node-fast-html-parser/commit/97fe5775b1202e35c6bb3b092740bb129c9a414a)) | ||
| ### [7.1.1](https://github.com/taoqf/node-fast-html-parser/compare/v8.0.0...v7.1.1) (2026-06-20) | ||
| ## [7.1.0](https://github.com/taoqf/node-fast-html-parser/compare/v7.0.2...v7.1.0) (2026-03-03) | ||
@@ -7,0 +20,0 @@ |
@@ -8,3 +8,3 @@ "use strict"; | ||
| const css_select_1 = require("css-select"); | ||
| const he_1 = __importDefault(require("he")); | ||
| const entities_1 = __importDefault(require("entities")); | ||
| const back_1 = __importDefault(require("../back")); | ||
@@ -18,4 +18,3 @@ const matcher_1 = __importDefault(require("../matcher")); | ||
| function decode(val) { | ||
| // clone string | ||
| return JSON.parse(JSON.stringify(he_1.default.decode(val))); | ||
| return entities_1.default.decodeHTML(val); | ||
| } | ||
@@ -22,0 +21,0 @@ // https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const he_1 = require("he"); | ||
| const entities_1 = require("entities"); | ||
| /** | ||
@@ -35,8 +35,8 @@ * Node Class as base class for TextNode and HTMLElement. | ||
| get textContent() { | ||
| return (0, he_1.decode)(this.rawText); | ||
| return (0, entities_1.decodeHTML)(this.rawText); | ||
| } | ||
| set textContent(val) { | ||
| this.rawText = (0, he_1.encode)(val); | ||
| this.rawText = (0, entities_1.encode)(val); | ||
| } | ||
| } | ||
| exports.default = Node; |
@@ -6,3 +6,3 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const he_1 = require("he"); | ||
| const entities_1 = require("entities"); | ||
| const node_1 = __importDefault(require("./node")); | ||
@@ -62,3 +62,3 @@ const type_1 = __importDefault(require("./type")); | ||
| get text() { | ||
| return (0, he_1.decode)(this.rawText); | ||
| return (0, entities_1.decodeHTML)(this.rawText); | ||
| } | ||
@@ -65,0 +65,0 @@ /** |
+8
-10
| { | ||
| "name": "node-html-parser", | ||
| "version": "7.1.0", | ||
| "version": "8.0.0", | ||
| "description": "A very fast HTML parser, generating a simplified DOM, with basic element query support.", | ||
@@ -54,7 +54,5 @@ "main": "dist/index.js", | ||
| "css-select": "^5.1.0", | ||
| "he": "1.2.0" | ||
| "entities": "^8.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/entities": "latest", | ||
| "@types/he": "latest", | ||
| "@types/node": "latest", | ||
@@ -66,3 +64,3 @@ "@typescript-eslint/eslint-plugin": "latest", | ||
| "boolbase": "^1.0.0", | ||
| "cheerio": "^1.0.0-rc.12", | ||
| "cheerio": "^1.2.0", | ||
| "cross-env": "^7.0.3", | ||
@@ -73,14 +71,14 @@ "eslint": "^8.23.1", | ||
| "high5": "^1.0.0", | ||
| "html-dom-parser": "^3.1.2", | ||
| "html-dom-parser": "^8.0.0", | ||
| "html-parser": "^0.11.0", | ||
| "html5parser": "^2.0.2", | ||
| "htmljs-parser": "^5.1.4", | ||
| "html5parser": "^3.0.0", | ||
| "htmljs-parser": "^5.10.2", | ||
| "htmlparser": "^1.7.7", | ||
| "htmlparser-benchmark": "^1.1.3", | ||
| "htmlparser2": "^8.0.1", | ||
| "mocha": "latest", | ||
| "mocha": "^11.7.6", | ||
| "mocha-each": "^2.0.1", | ||
| "neutron-html5parser": "^0.2.0", | ||
| "np": "latest", | ||
| "parse5": "^7.1.1", | ||
| "parse5": "^8.0.1", | ||
| "rimraf": "^3.0.2", | ||
@@ -87,0 +85,0 @@ "saxes": "^6.0.0", |
+37
-37
@@ -21,16 +21,16 @@ # Fast HTML Parser [](http://badge.fury.io/js/node-html-parser) [](https://actions-badge.atrox.dev/taoqf/node-html-parser/goto?ref=main) | ||
| -- 2022-08-10 | ||
| -- 2026-06-20 | ||
| ```shell | ||
| html-parser :24.1595 ms/file ± 18.7667 | ||
| htmljs-parser :4.72064 ms/file ± 5.67689 | ||
| html-dom-parser :2.18055 ms/file ± 2.96136 | ||
| html5parser :1.69639 ms/file ± 2.17111 | ||
| cheerio :12.2122 ms/file ± 8.10916 | ||
| parse5 :6.50626 ms/file ± 4.02352 | ||
| htmlparser2 :2.38179 ms/file ± 3.42389 | ||
| htmlparser :17.4820 ms/file ± 128.041 | ||
| high5 :3.95188 ms/file ± 2.52313 | ||
| node-html-parser:2.04288 ms/file ± 1.25203 | ||
| node-html-parser (last release):2.00527 ms/file ± 1.21317 | ||
| html-parser :12.5662 ms/file ± 10.0834 | ||
| htmljs-parser :0.233045 ms/file ± 0.525111 | ||
| html-dom-parser :1.07375 ms/file ± 0.811077 | ||
| html5parser :0.824501 ms/file ± 0.540651 | ||
| cheerio :3.27444 ms/file ± 2.06027 | ||
| parse5 :2.43857 ms/file ± 1.56153 | ||
| htmlparser2 :0.712490 ms/file ± 0.364630 | ||
| htmlparser :10.5275 ms/file ± 82.6013 | ||
| high5 :1.64003 ms/file ± 0.993116 | ||
| node-html-parser:0.972389 ms/file ± 0.570578 | ||
| node-html-parser (last release):0.961381 ms/file ± 0.553054 | ||
| ``` | ||
@@ -101,3 +101,3 @@ | ||
| }, | ||
| closeAllOnClosing: false // Close all non-closed tags when containing element closes | ||
| closeAllByClosing: false // Close all non-closed tags when containing element closes | ||
| } | ||
@@ -158,32 +158,32 @@ ``` | ||
| class Node{ | ||
| <<abstract>> | ||
| string toString() | ||
| Node clone() | ||
| this remove() | ||
| number nodeType | ||
| string innerText | ||
| string textContent | ||
| <<abstract>> | ||
| string toString() | ||
| Node clone() | ||
| this remove() | ||
| number nodeType | ||
| string innerText | ||
| string textContent | ||
| } | ||
| class ClassList{ | ||
| add(string c) | ||
| replace(string c1, string c2) | ||
| remove(string c) | ||
| toggle(string c) | ||
| boolean contains(string c) | ||
| number length | ||
| string[] value | ||
| string toString() | ||
| add(string c) | ||
| replace(string c1, string c2) | ||
| remove(string c) | ||
| toggle(string c) | ||
| boolean contains(string c) | ||
| number length | ||
| string[] value | ||
| string toString() | ||
| } | ||
| class CommentNode{ | ||
| CommentNode clone() | ||
| string toString() | ||
| CommentNode clone() | ||
| string toString() | ||
| } | ||
| class TextNode{ | ||
| TextNode clone() | ||
| string toString() | ||
| string rawText | ||
| string trimmedRawText | ||
| string trimmedText | ||
| string text | ||
| boolean isWhitespace | ||
| TextNode clone() | ||
| string toString() | ||
| string rawText | ||
| string trimmedRawText | ||
| string trimmedText | ||
| string text | ||
| boolean isWhitespace | ||
| } | ||
@@ -190,0 +190,0 @@ Node --|> HTMLElement |
Sorry, the diff of this file is too big to display
173014
0.25%33
-5.71%3780
-0.03%+ Added
+ Added
- Removed
- Removed