From 8cafad1fd3b44d6a5fcc7775e25999e4cae998ed Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 25 Sep 2018 12:09:25 -0400 Subject: [PATCH] refactor: directly use regex --- packages/core/src/createRenderer.ts | 4 ++-- packages/core/src/utils.ts | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/core/src/createRenderer.ts b/packages/core/src/createRenderer.ts index 1eb230e7..cf27d189 100644 --- a/packages/core/src/createRenderer.ts +++ b/packages/core/src/createRenderer.ts @@ -1,7 +1,7 @@ import { autorun, stop } from '@vue/observer' import { queueJob } from '@vue/scheduler' import { VNodeFlags, ChildrenFlags } from './flags' -import { EMPTY_OBJ, isReservedProp, lis } from './utils' +import { EMPTY_OBJ, reservedPropRE, lis } from './utils' import { VNode, MountedVNode, @@ -382,7 +382,7 @@ export function createRenderer(options: RendererOptions) { nextVNode: VNode, isSVG: boolean ) { - if (isReservedProp(key)) { + if (reservedPropRE.test(key)) { return } platformPatchData( diff --git a/packages/core/src/utils.ts b/packages/core/src/utils.ts index 51eb0ec6..e006fba8 100644 --- a/packages/core/src/utils.ts +++ b/packages/core/src/utils.ts @@ -4,9 +4,7 @@ export const NOOP = () => {} export const onRE = /^on/ export const nativeOnRE = /^nativeOn/ - -const reserveRE = /^(?:key|ref|slots)$|^nativeOn/ -export const isReservedProp = (key: string): boolean => reserveRE.test(key) +export const reservedPropRE = /^(?:key|ref|slots)$|^nativeOn/ export function normalizeStyle( value: any