mirror of
https://gitee.com/vuejs/vue.git
synced 2024-11-30 02:57:43 +08:00
fix caching with preserveWhiteSpace
This commit is contained in:
parent
0ab0600599
commit
fa46e8f88e
@ -1,10 +1,12 @@
|
||||
import { parse } from './html-parser'
|
||||
import { generate } from './codegen/index'
|
||||
|
||||
const cache = Object.create(null)
|
||||
const cache1 = Object.create(null)
|
||||
const cache2 = Object.create(null)
|
||||
|
||||
export function compile (html, preserveWhiteSpace) {
|
||||
html = html.trim()
|
||||
const cache = preserveWhiteSpace ? cache1 : cache2
|
||||
const hit = cache[html]
|
||||
return hit || (cache[html] = generate(parse(html, preserveWhiteSpace)))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user