feat: simplify prop/attr checking
This commit is contained in:
parent
ec0ccd2337
commit
35effdee5a
@ -8,7 +8,6 @@ import { isOn } from '@vue/shared'
|
|||||||
|
|
||||||
// value, checked, selected & muted
|
// value, checked, selected & muted
|
||||||
// plus anything with upperCase letter in it are always patched as properties
|
// plus anything with upperCase letter in it are always patched as properties
|
||||||
const domPropsRE = /\W|^(?:value|checked|selected|muted)$/
|
|
||||||
const domPropsReplaceRE = /^domProps/
|
const domPropsReplaceRE = /^domProps/
|
||||||
|
|
||||||
export function patchData(
|
export function patchData(
|
||||||
@ -32,7 +31,7 @@ export function patchData(
|
|||||||
default:
|
default:
|
||||||
if (isOn(key)) {
|
if (isOn(key)) {
|
||||||
patchEvent(el, key.slice(2).toLowerCase(), prevValue, nextValue)
|
patchEvent(el, key.slice(2).toLowerCase(), prevValue, nextValue)
|
||||||
} else if (domPropsRE.test(key)) {
|
} else if (key in el) {
|
||||||
patchDOMProp(
|
patchDOMProp(
|
||||||
el,
|
el,
|
||||||
key.replace(domPropsReplaceRE, '').toLowerCase(),
|
key.replace(domPropsReplaceRE, '').toLowerCase(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user