mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-04 21:17:55 +08:00
small improvements on html-parser (#4932)
* remove unnecessary code * not need to capture group when decoding attribute value * fix eslint
This commit is contained in:
parent
9df7870b7f
commit
f763fc2354
@ -56,8 +56,8 @@ const decodingMap = {
|
||||
'&': '&',
|
||||
' ': '\n'
|
||||
}
|
||||
const encodedAttr = /&(lt|gt|quot|amp);/g
|
||||
const encodedAttrWithNewLines = /&(lt|gt|quot|amp|#10);/g
|
||||
const encodedAttr = /&(?:lt|gt|quot|amp);/g
|
||||
const encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10);/g
|
||||
|
||||
function decodeAttr (value, shouldDecodeNewlines) {
|
||||
const re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr
|
||||
@ -210,7 +210,7 @@ export function parseHTML (html, options) {
|
||||
|
||||
function handleStartTag (match) {
|
||||
const tagName = match.tagName
|
||||
let unarySlash = match.unarySlash
|
||||
const unarySlash = match.unarySlash
|
||||
|
||||
if (expectHTML) {
|
||||
if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
|
||||
@ -246,7 +246,6 @@ export function parseHTML (html, options) {
|
||||
if (!unary) {
|
||||
stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs })
|
||||
lastTag = tagName
|
||||
unarySlash = ''
|
||||
}
|
||||
|
||||
if (options.start) {
|
||||
|
Loading…
Reference in New Issue
Block a user