node-html-parser
Advanced tools
Comparing version 3.1.3 to 3.1.4
@@ -107,2 +107,3 @@ import he from 'he'; | ||
this.rawAttrs = rawAttrs || ''; | ||
this.id = keyAttrs.id || ''; | ||
this.childNodes = []; | ||
@@ -112,3 +113,2 @@ this.classList = new DOMTokenList(keyAttrs.class ? keyAttrs.class.split(/\s+/) : [], (classList) => (this.setAttribute('class', classList.toString()) // eslint-disable-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call | ||
if (keyAttrs.id) { | ||
this.id = keyAttrs.id; | ||
if (!rawAttrs) { | ||
@@ -242,3 +242,3 @@ this.rawAttrs = `id="${keyAttrs.id}"`; | ||
// const is_void = void_tags.has(tag); | ||
const is_void = /area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr/i.test(tag); | ||
const is_void = /^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/i.test(tag); | ||
const attrs = this.rawAttrs ? ` ${this.rawAttrs}` : ''; | ||
@@ -570,2 +570,6 @@ if (is_void) { | ||
}).join(' '); | ||
// Update this.id | ||
if (key === 'id') { | ||
this.id = ''; | ||
} | ||
} | ||
@@ -612,2 +616,6 @@ hasAttribute(key) { | ||
}).join(' '); | ||
// Update this.id | ||
if (key === 'id') { | ||
this.id = value; | ||
} | ||
} | ||
@@ -614,0 +622,0 @@ /** |
@@ -369,2 +369,3 @@ var __extends = (this && this.__extends) || (function () { | ||
_this.rawAttrs = rawAttrs || ''; | ||
_this.id = keyAttrs.id || ''; | ||
_this.childNodes = []; | ||
@@ -374,3 +375,2 @@ _this.classList = new DOMTokenList(keyAttrs.class ? keyAttrs.class.split(/\s+/) : [], function (classList) { return (_this.setAttribute('class', classList.toString()) // eslint-disable-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call | ||
if (keyAttrs.id) { | ||
_this.id = keyAttrs.id; | ||
if (!rawAttrs) { | ||
@@ -530,3 +530,3 @@ _this.rawAttrs = "id=\"" + keyAttrs.id + "\""; | ||
// const is_void = void_tags.has(tag); | ||
var is_void = /area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr/i.test(tag); | ||
var is_void = /^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/i.test(tag); | ||
var attrs = this.rawAttrs ? " " + this.rawAttrs : ''; | ||
@@ -893,2 +893,6 @@ if (is_void) { | ||
}).join(' '); | ||
// Update this.id | ||
if (key === 'id') { | ||
this.id = ''; | ||
} | ||
}; | ||
@@ -935,2 +939,6 @@ HTMLElement.prototype.hasAttribute = function (key) { | ||
}).join(' '); | ||
// Update this.id | ||
if (key === 'id') { | ||
this.id = value; | ||
} | ||
}; | ||
@@ -937,0 +945,0 @@ /** |
@@ -146,2 +146,3 @@ "use strict"; | ||
_this.rawAttrs = rawAttrs || ''; | ||
_this.id = keyAttrs.id || ''; | ||
_this.childNodes = []; | ||
@@ -151,3 +152,2 @@ _this.classList = new DOMTokenList(keyAttrs.class ? keyAttrs.class.split(/\s+/) : [], function (classList) { return (_this.setAttribute('class', classList.toString()) // eslint-disable-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call | ||
if (keyAttrs.id) { | ||
_this.id = keyAttrs.id; | ||
if (!rawAttrs) { | ||
@@ -669,2 +669,6 @@ _this.rawAttrs = "id=\"" + keyAttrs.id + "\""; | ||
}).join(' '); | ||
// Update this.id | ||
if (key === 'id') { | ||
this.id = ''; | ||
} | ||
}; | ||
@@ -711,2 +715,6 @@ HTMLElement.prototype.hasAttribute = function (key) { | ||
}).join(' '); | ||
// Update this.id | ||
if (key === 'id') { | ||
this.id = value; | ||
} | ||
}; | ||
@@ -713,0 +721,0 @@ /** |
{ | ||
"name": "node-html-parser", | ||
"version": "3.1.3", | ||
"version": "3.1.4", | ||
"description": "A very fast HTML parser, generating a simplified DOM, with basic element query support.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
166048
4464