Skip to content

Commit

Permalink
fix: always treat spellcheck and draggable as attributes
Browse files Browse the repository at this point in the history
fix #1350
  • Loading branch information
yyx990803 committed Jun 12, 2020
1 parent 8084156 commit 4492b88
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/runtime-dom/src/patchProp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ export const patchProp: RendererOptions<Node, Element>['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' ||
Expand All @@ -43,7 +51,7 @@ export const patchProp: RendererOptions<Node, Element>['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,
Expand Down

0 comments on commit 4492b88

Please sign in to comment.