Skip to content

Commit

Permalink
fix(parser): Implied close indices would be misreported (#933)
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed Aug 29, 2021
1 parent 78ef1b7 commit 903fb43
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 116 deletions.
2 changes: 1 addition & 1 deletion src/Parser.ts
Expand Up @@ -330,7 +330,7 @@ export class Parser {
let count = this.stack.length - pos;
while (count--) {
// We know the stack has sufficient elements.
this.cbs.onclosetag(this.stack.pop()!, pos !== 0);
this.cbs.onclosetag(this.stack.pop()!, count !== 0);
}
} else this.stack.length = pos;
} else if (!this.options.xmlMode && name === "p") {
Expand Down
2 changes: 1 addition & 1 deletion src/__fixtures__/Events/02-template.json
Expand Up @@ -48,7 +48,7 @@
"event": "closetag",
"startIndex": 49,
"endIndex": 57,
"data": ["script", true]
"data": ["script", false]
},
{
"event": "closetag",
Expand Down
18 changes: 9 additions & 9 deletions src/__fixtures__/Events/08-implicit-close-tags.json
Expand Up @@ -156,7 +156,7 @@
"event": "closetag",
"startIndex": 83,
"endIndex": 87,
"data": ["h3", true]
"data": ["h3", false]
},
{
"event": "closetag",
Expand Down Expand Up @@ -216,7 +216,7 @@
"event": "closetag",
"startIndex": 104,
"endIndex": 109,
"data": ["div", true]
"data": ["div", false]
},
{
"event": "closetag",
Expand Down Expand Up @@ -258,7 +258,7 @@
"event": "closetag",
"startIndex": 123,
"endIndex": 128,
"data": ["div", true]
"data": ["div", false]
},
{
"event": "closetag",
Expand All @@ -276,13 +276,13 @@
"event": "closetag",
"startIndex": 129,
"endIndex": 136,
"data": ["table", true]
"data": ["table", false]
},
{
"event": "closetag",
"startIndex": 137,
"endIndex": 142,
"data": ["div", true]
"data": ["div", false]
},
{
"event": "closetag",
Expand Down Expand Up @@ -336,19 +336,19 @@
"event": "closetag",
"startIndex": 165,
"endIndex": 169,
"data": ["h3", true]
"data": ["h3", false]
},
{
"event": "closetag",
"startIndex": 170,
"endIndex": 175,
"data": ["div", true]
"data": ["div", false]
},
{
"event": "closetag",
"startIndex": 176,
"endIndex": 180,
"data": ["li", true]
"data": ["li", false]
},
{
"event": "closetag",
Expand Down Expand Up @@ -480,7 +480,7 @@
"event": "closetag",
"startIndex": 231,
"endIndex": 235,
"data": ["li", false]
"data": ["li", true]
},
{
"event": "closetag",
Expand Down
2 changes: 1 addition & 1 deletion src/__fixtures__/Events/11-script_in_script.json
Expand Up @@ -36,7 +36,7 @@
"event": "closetag",
"startIndex": 44,
"endIndex": 52,
"data": ["script", true]
"data": ["script", false]
},
{
"event": "closetag",
Expand Down
4 changes: 2 additions & 2 deletions src/__fixtures__/Events/24-special_special.json
Expand Up @@ -54,7 +54,7 @@
"event": "closetag",
"startIndex": 42,
"endIndex": 45,
"data": ["b", true]
"data": ["b", false]
},
{
"event": "closetag",
Expand Down Expand Up @@ -90,7 +90,7 @@
"event": "closetag",
"startIndex": 64,
"endIndex": 67,
"data": ["b", true]
"data": ["b", false]
},
{
"event": "closetag",
Expand Down
6 changes: 3 additions & 3 deletions src/__fixtures__/Events/44-indices.json
Expand Up @@ -54,7 +54,7 @@
"event": "closetag",
"startIndex": 39,
"endIndex": 46,
"data": ["title", true]
"data": ["title", false]
},
{
"event": "text",
Expand Down Expand Up @@ -108,13 +108,13 @@
"event": "closetag",
"startIndex": 81,
"endIndex": 84,
"data": ["p", true]
"data": ["p", false]
},
{
"event": "closetag",
"startIndex": 85,
"endIndex": 91,
"data": ["body", true]
"data": ["body", false]
},
{
"event": "text",
Expand Down

0 comments on commit 903fb43

Please sign in to comment.