From 4492b88938922a7f1bcc36a608375ad99f16b22e Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 12 Jun 2020 12:40:54 -0400 Subject: [PATCH] fix: always treat spellcheck and draggable as attributes fix #1350 --- packages/runtime-dom/src/patchProp.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/runtime-dom/src/patchProp.ts b/packages/runtime-dom/src/patchProp.ts index 979f9f24..4aa8c010 100644 --- a/packages/runtime-dom/src/patchProp.ts +++ b/packages/runtime-dom/src/patchProp.ts @@ -34,7 +34,15 @@ export const patchProp: RendererOptions['patchProp'] = ( patchEvent(el, key, prevValue, nextValue, parentComponent) } } else if ( - isSVG + // spellcheck and draggable are numerated attrs, however their + // corresponding DOM properties are actually booleans - this leads to + // setting it with a string "false" value leading it to be coerced to + // `true`, so we need to always treat them as attributes. + // Note that `contentEditable` doesn't have this problem: its DOM + // property is also enumerated string values. + key !== 'spellcheck' && + key !== 'draggable' && + (isSVG ? // most keys must be set as attribute on svg elements to work // ...except innerHTML key === 'innerHTML' || @@ -43,7 +51,7 @@ export const patchProp: RendererOptions['patchProp'] = ( : // for normal html elements, set as a property if it exists key in el && // except native onclick with string values - !(nativeOnRE.test(key) && isString(nextValue)) + !(nativeOnRE.test(key) && isString(nextValue))) ) { patchDOMProp( el,