Skip to content

Commit 3539fe2

Browse files
committed
normalize to tab indents
1 parent 03c8dca commit 3539fe2

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/nodes/html.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,14 +1082,14 @@ export function base_parse(data: string, options = { lowerCaseTagName: false, co
10821082
}
10831083
}
10841084

1085-
// Prevent nested A tags by terminating the last A and starting a new one : see issue #144
1085+
// Prevent nested A tags by terminating the last A and starting a new one : see issue #144
10861086
if (match[2] === 'a') {
1087-
if (noNestedTagIndex !== undefined) {
1088-
stack.splice(noNestedTagIndex);
1089-
currentParent = arr_back(stack);
1090-
}
1091-
noNestedTagIndex = stack.length;
1092-
}
1087+
if (noNestedTagIndex !== undefined) {
1088+
stack.splice(noNestedTagIndex);
1089+
currentParent = arr_back(stack);
1090+
}
1091+
noNestedTagIndex = stack.length;
1092+
}
10931093

10941094
const tagEndPos = kMarkupPattern.lastIndex;
10951095
const tagStartPos = tagEndPos - match[0].length;
@@ -1128,7 +1128,7 @@ export function base_parse(data: string, options = { lowerCaseTagName: false, co
11281128
// Handle closing tags or self-closed elements (ie </tag> or <br>)
11291129
if (match[1] || match[4] || kSelfClosingElements[match[2]]) {
11301130
while (true) {
1131-
if (match[2] === 'a') noNestedTagIndex = undefined;
1131+
if (match[2] === 'a') noNestedTagIndex = undefined;
11321132
if (currentParent.rawTagName === match[2]) {
11331133
// Update range end for closed tag
11341134
(<[number, number]>currentParent.range)[1] = createRange(-1, Math.max(lastTextPos, tagEndPos))[1];

test/144.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ describe('issue 144', function () {
1919
b.childNodes.length.should.eql(1);
2020
b.text.should.eql('link ');
2121

22-
const a2 = root.childNodes[1];
23-
a2.tagName.should.eql('A');
24-
a2.nodeType.should.eql(NodeType.ELEMENT_NODE);
25-
a2.childNodes.length.should.eql(1);
26-
a2.childNodes[0].nodeType.should.eql(NodeType.TEXT_NODE);
27-
a2.text.should.eql('nested link');
22+
const a2 = root.childNodes[1];
23+
a2.tagName.should.eql('A');
24+
a2.nodeType.should.eql(NodeType.ELEMENT_NODE);
25+
a2.childNodes.length.should.eql(1);
26+
a2.childNodes[0].nodeType.should.eql(NodeType.TEXT_NODE);
27+
a2.text.should.eql('nested link');
2828

2929
const endText = root.childNodes[2];
30-
endText.nodeType.should.eql(NodeType.TEXT_NODE);
31-
endText.textContent.should.eql(' end');
30+
endText.nodeType.should.eql(NodeType.TEXT_NODE);
31+
endText.textContent.should.eql(' end');
3232
});
3333
});

0 commit comments

Comments
 (0)