Skip to content

Commit 714f793

Browse files
committed
remove unnecessary code in html-parser
1 parent 5d582df commit 714f793

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

src/compiler/parser/html-parser.js

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export function parseHTML (html, handler) {
6363
const expectHTML = handler.expectHTML
6464
const isUnaryTag = handler.isUnaryTag || no
6565
const isSpecialTag = handler.isSpecialTag || special
66-
let last, prevTag, nextTag, lastTag
66+
let last, lastTag
6767
while (html) {
6868
last = html
6969
// Make sure we're not in a script or style element
@@ -76,7 +76,6 @@ export function parseHTML (html, handler) {
7676

7777
if (commentEnd >= 0) {
7878
html = html.substring(commentEnd + 3)
79-
prevTag = ''
8079
continue
8180
}
8281
}
@@ -87,7 +86,6 @@ export function parseHTML (html, handler) {
8786

8887
if (conditionalEnd >= 0) {
8988
html = html.substring(conditionalEnd + 2)
90-
prevTag = ''
9189
continue
9290
}
9391
}
@@ -99,7 +97,6 @@ export function parseHTML (html, handler) {
9997
handler.doctype(doctypeMatch[0])
10098
}
10199
html = html.substring(doctypeMatch[0].length)
102-
prevTag = ''
103100
continue
104101
}
105102

@@ -108,7 +105,6 @@ export function parseHTML (html, handler) {
108105
if (endTagMatch) {
109106
html = html.substring(endTagMatch[0].length)
110107
endTagMatch[0].replace(endTag, parseEndTag)
111-
prevTag = '/' + endTagMatch[1].toLowerCase()
112108
continue
113109
}
114110

@@ -117,7 +113,6 @@ export function parseHTML (html, handler) {
117113
if (startTagMatch) {
118114
html = startTagMatch.rest
119115
handleStartTag(startTagMatch)
120-
prevTag = startTagMatch.tagName.toLowerCase()
121116
continue
122117
}
123118
}
@@ -131,23 +126,9 @@ export function parseHTML (html, handler) {
131126
html = ''
132127
}
133128

134-
// next tag
135-
let nextTagMatch = parseStartTag(html)
136-
if (nextTagMatch) {
137-
nextTag = nextTagMatch.tagName
138-
} else {
139-
nextTagMatch = html.match(endTag)
140-
if (nextTagMatch) {
141-
nextTag = '/' + nextTagMatch[1]
142-
} else {
143-
nextTag = ''
144-
}
145-
}
146-
147129
if (handler.chars) {
148-
handler.chars(text, prevTag, nextTag)
130+
handler.chars(text)
149131
}
150-
prevTag = ''
151132
} else {
152133
const stackedTag = lastTag.toLowerCase()
153134
const reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)</' + stackedTag + '[^>]*>', 'i'))

0 commit comments

Comments
 (0)