node-html-parser 6.1.12 → 6.1.13

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 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.13](https://github.com/taoqf/node-fast-html-parser/compare/v6.1.12...v6.1.13) (2024-03-29)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * add rawTagName [#269](https://github.com/taoqf/node-fast-html-parser/issues/269) [#270](https://github.com/taoqf/node-fast-html-parser/issues/270) ([9ac642d](https://github.com/taoqf/node-fast-html-parser/commit/9ac642d7b6a97c84fd4471b8eaa0bd9debf5e325))
11
+
5
12
  ### [6.1.12](https://github.com/taoqf/node-fast-html-parser/compare/v6.1.11...v6.1.12) (2023-12-25)
6
13
 
7
14
 
package/dist/main.js CHANGED
@@ -263,6 +263,7 @@ define("nodes/text", ["require", "exports", "he", "nodes/node", "nodes/type"], f
263
263
  * @type {Number}
264
264
  */
265
265
  _this.nodeType = type_2.default.TEXT_NODE;
266
+ _this.rawTagName = '';
266
267
  _this._rawText = rawText;
267
268
  return _this;
268
269
  }
@@ -1558,10 +1559,12 @@ define("nodes/comment", ["require", "exports", "nodes/node", "nodes/type"], func
1558
1559
  type_4 = __importDefault(type_4);
1559
1560
  var CommentNode = /** @class */ (function (_super) {
1560
1561
  __extends(CommentNode, _super);
1561
- function CommentNode(rawText, parentNode, range) {
1562
+ function CommentNode(rawText, parentNode, range, rawTagName) {
1562
1563
  if (parentNode === void 0) { parentNode = null; }
1564
+ if (rawTagName === void 0) { rawTagName = '!--'; }
1563
1565
  var _this = _super.call(this, parentNode, range) || this;
1564
1566
  _this.rawText = rawText;
1567
+ _this.rawTagName = rawTagName;
1565
1568
  /**
1566
1569
  * Node Type declaration.
1567
1570
  * @type {Number}
@@ -1570,7 +1573,7 @@ define("nodes/comment", ["require", "exports", "nodes/node", "nodes/type"], func
1570
1573
  return _this;
1571
1574
  }
1572
1575
  CommentNode.prototype.clone = function () {
1573
- return new CommentNode(this.rawText, null);
1576
+ return new CommentNode(this.rawText, null, undefined, this.rawTagName);
1574
1577
  };
1575
1578
  Object.defineProperty(CommentNode.prototype, "text", {
1576
1579
  /**
@@ -3,8 +3,9 @@ import Node from './node';
3
3
  import NodeType from './type';
4
4
  export default class CommentNode extends Node {
5
5
  rawText: string;
6
+ rawTagName: string;
6
7
  clone(): CommentNode;
7
- constructor(rawText: string, parentNode?: HTMLElement, range?: [number, number]);
8
+ constructor(rawText: string, parentNode?: HTMLElement, range?: [number, number], rawTagName?: string);
8
9
  /**
9
10
  * Node Type declaration.
10
11
  * @type {Number}
@@ -22,10 +22,12 @@ var node_1 = __importDefault(require("./node"));
22
22
  var type_1 = __importDefault(require("./type"));
23
23
  var CommentNode = /** @class */ (function (_super) {
24
24
  __extends(CommentNode, _super);
25
- function CommentNode(rawText, parentNode, range) {
25
+ function CommentNode(rawText, parentNode, range, rawTagName) {
26
26
  if (parentNode === void 0) { parentNode = null; }
27
+ if (rawTagName === void 0) { rawTagName = '!--'; }
27
28
  var _this = _super.call(this, parentNode, range) || this;
28
29
  _this.rawText = rawText;
30
+ _this.rawTagName = rawTagName;
29
31
  /**
30
32
  * Node Type declaration.
31
33
  * @type {Number}
@@ -34,7 +36,7 @@ var CommentNode = /** @class */ (function (_super) {
34
36
  return _this;
35
37
  }
36
38
  CommentNode.prototype.clone = function () {
37
- return new CommentNode(this.rawText, null);
39
+ return new CommentNode(this.rawText, null, undefined, this.rawTagName);
38
40
  };
39
41
  Object.defineProperty(CommentNode.prototype, "text", {
40
42
  /**
@@ -5,6 +5,7 @@ import HTMLElement from './html';
5
5
  */
6
6
  export default abstract class Node {
7
7
  parentNode: HTMLElement;
8
+ abstract rawTagName: string;
8
9
  abstract nodeType: NodeType;
9
10
  childNodes: Node[];
10
11
  range: readonly [number, number];
@@ -13,6 +13,7 @@ export default class TextNode extends Node {
13
13
  * @type {Number}
14
14
  */
15
15
  nodeType: NodeType;
16
+ rawTagName: string;
16
17
  private _rawText;
17
18
  private _trimmedRawText?;
18
19
  private _trimmedText?;
@@ -35,6 +35,7 @@ var TextNode = /** @class */ (function (_super) {
35
35
  * @type {Number}
36
36
  */
37
37
  _this.nodeType = type_1.default.TEXT_NODE;
38
+ _this.rawTagName = '';
38
39
  _this._rawText = rawText;
39
40
  return _this;
40
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-html-parser",
3
- "version": "6.1.12",
3
+ "version": "6.1.13",
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",