Skip to content

Commit 1eef022

Browse files
committed
Fix: bugs about auto-closing of dt/dd
1 parent 6d3fbbb commit 1eef022

File tree

5 files changed

+1130
-1
lines changed

5 files changed

+1130
-1
lines changed

src/html/parser.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {IntermediateToken, IntermediateTokenizer, EndTag, Mustache, StartTag, Te
1515
import {Tokenizer} from "./tokenizer"
1616

1717
const DIRECTIVE_NAME = /^(?:v-|[:@]).+[^.:@]$/
18+
const DT_DD = /^d[dt]$/
1819
const DUMMY_PARENT: any = Object.freeze({})
1920

2021
/**
@@ -296,6 +297,9 @@ export class Parser {
296297
if (element.name === name && HTML_CAN_BE_LEFT_OPEN_TAGS.has(name)) {
297298
this.popElementStack()
298299
}
300+
if (DT_DD.test(element.name) && DT_DD.test(name)) {
301+
this.popElementStack()
302+
}
299303
}
300304

301305
/**

src/html/util/tag-names.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const HTML_VOID_ELEMENT_TAGS = new Set([
4141
* https://github.com/vuejs/vue/blob/e4da249ab8ef32a0b8156c840c9d2b9773090f8a/src/platforms/web/compiler/util.js#L12
4242
*/
4343
export const HTML_CAN_BE_LEFT_OPEN_TAGS = new Set([
44-
"colgroup", "dd", "dt", "li", "options", "p", "td", "tfoot", "th", "thead",
44+
"colgroup", "li", "options", "p", "td", "tfoot", "th", "thead",
4545
"tr", "source",
4646
])
4747

0 commit comments

Comments
 (0)