From 959a95999a47a981617a034485c7404c6dc1fdc7 Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 22 Apr 2016 14:34:00 -0400 Subject: [PATCH] cache decodeHTML --- src/compiler/parser/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler/parser/index.js b/src/compiler/parser/index.js index 21e4c86b..0d48c314 100644 --- a/src/compiler/parser/index.js +++ b/src/compiler/parser/index.js @@ -1,7 +1,7 @@ import { decodeHTML } from 'entities' import { parseHTML } from './html-parser' import { parseText } from './text-parser' -import { hyphenate, makeMap } from '../../shared/util' +import { hyphenate, makeMap, cached } from '../../shared/util' import { getAndRemoveAttr, addProp, @@ -21,6 +21,8 @@ const forAliasRE = /(.*)\s+(?:in|of)\s+(.*)/ const forIteratorRE = /\((.*),(.*)\)/ const camelRE = /[a-z\d][A-Z]/ +const decodeHTMLCached = cached(decodeHTML) + // attributes that should be using props for binding const mustUseProp = makeMap('value,selected,checked,muted') @@ -155,7 +157,7 @@ export function parse (template, options) { return } text = currentParent.tag === 'pre' || text.trim() - ? decodeHTML(text) + ? decodeHTMLCached(text) // only preserve whitespace if its not right after a starting tag : options.preserveWhitespace && currentParent.children.length ? ' '