From 93d724382ee59a9f2bae259fc17bbde9bc460ef0 Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 12 Oct 2018 17:42:08 -0400 Subject: [PATCH] feat: process certain attrs as properties --- packages/renderer-dom/src/modules/attrs.ts | 20 ++++++++++---------- packages/renderer-dom/src/patchData.ts | 4 +++- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/renderer-dom/src/modules/attrs.ts b/packages/renderer-dom/src/modules/attrs.ts index d32f6608..3254f0fc 100644 --- a/packages/renderer-dom/src/modules/attrs.ts +++ b/packages/renderer-dom/src/modules/attrs.ts @@ -1,3 +1,13 @@ +const xlinkNS = 'http://www.w3.org/1999/xlink' + +function isXlink(name: string): boolean { + return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink' +} + +function getXlinkProp(name: string): string { + return isXlink(name) ? name.slice(6, name.length) : '' +} + export function patchAttr( el: Element, key: string, @@ -19,13 +29,3 @@ export function patchAttr( } } } - -const xlinkNS = 'http://www.w3.org/1999/xlink' - -function isXlink(name: string): boolean { - return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink' -} - -function getXlinkProp(name: string): string { - return isXlink(name) ? name.slice(6, name.length) : '' -} diff --git a/packages/renderer-dom/src/patchData.ts b/packages/renderer-dom/src/patchData.ts index be805a54..d13e8057 100644 --- a/packages/renderer-dom/src/patchData.ts +++ b/packages/renderer-dom/src/patchData.ts @@ -6,7 +6,9 @@ import { patchDOMProp } from './modules/props' import { patchEvent } from './modules/events' export const onRE = /^on/ -const domPropsRE = /^domProps/ + +// value, checked, selected & muted are always patched as properties +const domPropsRE = /^domProps|^(?:value|checked|selected|muted)$/ export function patchData( el: Element,