@@ -1,4 +1,4 @@
|
||||
import { EMPTY_OBJ } from '@vue/shared'
|
||||
import { EMPTY_OBJ, isString } from '@vue/shared'
|
||||
import {
|
||||
ComponentInternalInstance,
|
||||
callWithAsyncErrorHandling
|
||||
@@ -66,11 +66,22 @@ export function removeEventListener(
|
||||
|
||||
export function patchEvent(
|
||||
el: Element,
|
||||
name: string,
|
||||
rawName: string,
|
||||
prevValue: EventValueWithOptions | EventValue | null,
|
||||
nextValue: EventValueWithOptions | EventValue | null,
|
||||
instance: ComponentInternalInstance | null = null
|
||||
) {
|
||||
// support native onxxx handlers
|
||||
if (rawName in el) {
|
||||
if (isString(nextValue)) {
|
||||
el.setAttribute(rawName, nextValue)
|
||||
} else {
|
||||
;(el as any)[rawName] = nextValue
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
const name = rawName.slice(2).toLowerCase()
|
||||
const prevOptions = prevValue && 'options' in prevValue && prevValue.options
|
||||
const nextOptions = nextValue && 'options' in nextValue && nextValue.options
|
||||
const invoker = prevValue && prevValue.invoker
|
||||
|
||||
@@ -29,13 +29,7 @@ export const patchProp: RendererOptions<Node, Element>['patchProp'] = (
|
||||
if (isOn(key)) {
|
||||
// ignore v-model listeners
|
||||
if (key.indexOf('onUpdate:') < 0) {
|
||||
patchEvent(
|
||||
el,
|
||||
key.slice(2).toLowerCase(),
|
||||
prevValue,
|
||||
nextValue,
|
||||
parentComponent
|
||||
)
|
||||
patchEvent(el, key, prevValue, nextValue, parentComponent)
|
||||
}
|
||||
} else if (!isSVG && key in el) {
|
||||
patchDOMProp(
|
||||
|
||||
Reference in New Issue
Block a user