node-html-parser 1.2.15 → 1.2.16
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/dist/main.js +2 -6
- package/dist/nodes/html.js +2 -6
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -544,15 +544,11 @@ define("nodes/html", ["require", "exports", "he", "nodes/node", "nodes/type", "n
|
|
|
544
544
|
HTMLElement.prototype.toString = function () {
|
|
545
545
|
var tag = this.tagName;
|
|
546
546
|
if (tag) {
|
|
547
|
-
var
|
|
548
|
-
var is_self_closed = /^(img|br|hr|area|base|input|doctype|link)$/i.test(tag);
|
|
547
|
+
var is_void = /^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/i.test(tag);
|
|
549
548
|
var attrs = this.rawAttrs ? ' ' + this.rawAttrs : '';
|
|
550
|
-
if (
|
|
549
|
+
if (is_void) {
|
|
551
550
|
return "<" + tag + attrs + ">";
|
|
552
551
|
}
|
|
553
|
-
else if (is_self_closed) {
|
|
554
|
-
return "<" + tag + attrs + " />";
|
|
555
|
-
}
|
|
556
552
|
else {
|
|
557
553
|
return "<" + tag + attrs + ">" + this.innerHTML + "</" + tag + ">";
|
|
558
554
|
}
|
package/dist/nodes/html.js
CHANGED
|
@@ -176,15 +176,11 @@ var HTMLElement = /** @class */ (function (_super) {
|
|
|
176
176
|
HTMLElement.prototype.toString = function () {
|
|
177
177
|
var tag = this.tagName;
|
|
178
178
|
if (tag) {
|
|
179
|
-
var
|
|
180
|
-
var is_self_closed = /^(img|br|hr|area|base|input|doctype|link)$/i.test(tag);
|
|
179
|
+
var is_void = /^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/i.test(tag);
|
|
181
180
|
var attrs = this.rawAttrs ? ' ' + this.rawAttrs : '';
|
|
182
|
-
if (
|
|
181
|
+
if (is_void) {
|
|
183
182
|
return "<" + tag + attrs + ">";
|
|
184
183
|
}
|
|
185
|
-
else if (is_self_closed) {
|
|
186
|
-
return "<" + tag + attrs + " />";
|
|
187
|
-
}
|
|
188
184
|
else {
|
|
189
185
|
return "<" + tag + attrs + ">" + this.innerHTML + "</" + tag + ">";
|
|
190
186
|
}
|
package/package.json
CHANGED