|
|
@ -46,7 +46,7 @@ let IS_REGEX_CAPTURING_BROKEN = false |
|
|
|
}) |
|
|
|
|
|
|
|
// Special Elements (can contain anything)
|
|
|
|
const isScriptOrStyle = makeMap('script,style', true) |
|
|
|
const isPlainTextElement = makeMap('script,style,textarea', true) |
|
|
|
const reCache = {} |
|
|
|
|
|
|
|
const decodingMap = { |
|
|
@ -72,8 +72,8 @@ export function parseHTML (html, options) { |
|
|
|
let last, lastTag |
|
|
|
while (html) { |
|
|
|
last = html |
|
|
|
// Make sure we're not in a script or style element
|
|
|
|
if (!lastTag || !isScriptOrStyle(lastTag)) { |
|
|
|
// Make sure we're not in a plaintext content element like script/style
|
|
|
|
if (!lastTag || !isPlainTextElement(lastTag)) { |
|
|
|
let textEnd = html.indexOf('<') |
|
|
|
if (textEnd === 0) { |
|
|
|
// Comment:
|
|
|
@ -153,7 +153,7 @@ export function parseHTML (html, options) { |
|
|
|
var endTagLength = 0 |
|
|
|
var rest = html.replace(reStackedTag, function (all, text, endTag) { |
|
|
|
endTagLength = endTag.length |
|
|
|
if (stackedTag !== 'script' && stackedTag !== 'style' && stackedTag !== 'noscript') { |
|
|
|
if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') { |
|
|
|
text = text |
|
|
|
.replace(/<!--([\s\S]*?)-->/g, '$1') |
|
|
|
.replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1') |
|
|
|