25 lines
1.2 KiB
Diff
25 lines
1.2 KiB
Diff
Remove after https://github.com/taoqf/node-html-parser/pull/39
|
|
is merged and released.
|
|
|
|
diff --git a/node_modules/node-html-parser/dist/nodes/html.js b/node_modules/node-html-parser/dist/nodes/html.js
|
|
index a3c33b1..8b4c2b2 100644
|
|
--- a/node_modules/node-html-parser/dist/nodes/html.js
|
|
+++ b/node_modules/node-html-parser/dist/nodes/html.js
|
|
@@ -176,15 +176,11 @@ var HTMLElement = /** @class */ (function (_super) {
|
|
HTMLElement.prototype.toString = function () {
|
|
var tag = this.tagName;
|
|
if (tag) {
|
|
- var is_un_closed = /^meta$/i.test(tag);
|
|
- var is_self_closed = /^(img|br|hr|area|base|input|doctype|link)$/i.test(tag);
|
|
+ const 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 : '';
|
|
- if (is_un_closed) {
|
|
+ if (is_void) {
|
|
return "<" + tag + attrs + ">";
|
|
}
|
|
- else if (is_self_closed) {
|
|
- return "<" + tag + attrs + " />";
|
|
- }
|
|
else {
|
|
return "<" + tag + attrs + ">" + this.innerHTML + "</" + tag + ">";
|
|
}
|