Unverified Commit a20f70ed authored by LK HO's avatar LK HO Committed by GitHub

fix: rendering/html-core - null checks (#3823)

parent 70d4c069
...@@ -237,7 +237,7 @@ module.exports = { ...@@ -237,7 +237,7 @@ module.exports = {
// -------------------------------- // --------------------------------
$('body').contents().toArray().forEach(item => { $('body').contents().toArray().forEach(item => {
if (item.type === 'text' && item.parent.name === 'body') { if (item && item.type === 'text' && item.parent.name === 'body') {
$(item).wrap('<div></div>') $(item).wrap('<div></div>')
} }
}) })
...@@ -249,7 +249,7 @@ module.exports = { ...@@ -249,7 +249,7 @@ module.exports = {
function iterateMustacheNode (node) { function iterateMustacheNode (node) {
const list = $(node).contents().toArray() const list = $(node).contents().toArray()
list.forEach(item => { list.forEach(item => {
if (item.type === 'text') { if (item && item.type === 'text') {
const rawText = $(item).text().replace(/\r?\n|\r/g, '') const rawText = $(item).text().replace(/\r?\n|\r/g, '')
if (mustacheRegExp.test(rawText)) { if (mustacheRegExp.test(rawText)) {
$(item).parent().attr('v-pre', true) $(item).parent().attr('v-pre', true)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment