We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 10fc685 commit fcfc1e9Copy full SHA for fcfc1e9
index.js
@@ -34,9 +34,7 @@ module.exports = function postHTMLParser(html) {
34
last.content.push(comment);
35
},
36
onopentag: function(tag, attrs) {
37
- var buf = {};
38
-
39
- buf.tag = tag;
+ var buf = { tag: tag };
40
41
if (Object.keys(attrs).length) {
42
buf.attrs = attrs;
@@ -47,15 +45,16 @@ module.exports = function postHTMLParser(html) {
47
45
onclosetag: function() {
48
46
var buf = bufArray.pop();
49
50
- if (bufArray.length === 0) {
+ if (!bufArray.length) {
51
results.push(buf);
52
return;
53
}
54
55
var last = bufArray.last();
56
- if (!(last.content instanceof Array)) {
+ if (!Array.isArray(last.content)) {
57
last.content = [];
58
+
59
last.content.push(buf);
60
61
ontext: function(text) {
0 commit comments