Просмотр исходного кода

refactor: use shared util, remove unused regex

Evan You 7 лет назад
Родитель
Сommit
aac7805b3a

+ 3 - 8
packages/core/src/vdom.ts

@@ -5,16 +5,11 @@ import {
 } from './component'
 import { VNodeFlags, ChildrenFlags } from './flags'
 import { createComponentClassFromOptions } from './componentUtils'
-import {
-  handlersRE,
-  EMPTY_OBJ,
-  isObject,
-  isArray,
-  isFunction,
-  isString
-} from '@vue/shared'
+import { EMPTY_OBJ, isObject, isArray, isFunction, isString } from '@vue/shared'
 import { RawChildrenType, RawSlots } from './h'
 
+const handlersRE = /^on|^vnode/
+
 // Vue core is platform agnostic, so we are not using Element for "DOM" nodes.
 export interface RenderNode {
   vnode?: VNode | null

+ 1 - 2
packages/renderer-dom/src/patchData.ts

@@ -4,8 +4,7 @@ import { patchStyle } from './modules/style'
 import { patchAttr } from './modules/attrs'
 import { patchDOMProp } from './modules/props'
 import { patchEvent } from './modules/events'
-
-export const onRE = /^on/
+import { onRE } from '@vue/shared'
 
 // value, checked, selected & muted
 // plus anything with upperCase letter in it are always patched as properties

+ 1 - 1
packages/renderer-dom/src/teardownVNode.ts

@@ -1,6 +1,6 @@
 import { VNode } from '@vue/core'
 import { handleDelegatedEvent } from './modules/events'
-import { onRE } from './patchData'
+import { onRE } from '@vue/shared'
 
 export function teardownVNode(vnode: VNode) {
   const { el, data } = vnode

+ 0 - 2
packages/shared/src/index.ts

@@ -3,8 +3,6 @@ export const EMPTY_OBJ: { readonly [key: string]: any } = Object.freeze({})
 export const NOOP = () => {}
 
 export const onRE = /^on/
-export const vnodeHookRE = /^vnode/
-export const handlersRE = /^on|^vnode/
 export const reservedPropRE = /^(?:key|ref|slots)$|^vnode/
 
 export const isArray = Array.isArray