Skip to content

Commit 4492b88

Browse files
committed
fix: always treat spellcheck and draggable as attributes
fix #1350
1 parent 8084156 commit 4492b88

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/runtime-dom/src/patchProp.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ export const patchProp: RendererOptions<Node, Element>['patchProp'] = (
3434
patchEvent(el, key, prevValue, nextValue, parentComponent)
3535
}
3636
} else if (
37-
isSVG
37+
// spellcheck and draggable are numerated attrs, however their
38+
// corresponding DOM properties are actually booleans - this leads to
39+
// setting it with a string "false" value leading it to be coerced to
40+
// `true`, so we need to always treat them as attributes.
41+
// Note that `contentEditable` doesn't have this problem: its DOM
42+
// property is also enumerated string values.
43+
key !== 'spellcheck' &&
44+
key !== 'draggable' &&
45+
(isSVG
3846
? // most keys must be set as attribute on svg elements to work
3947
// ...except innerHTML
4048
key === 'innerHTML' ||
@@ -43,7 +51,7 @@ export const patchProp: RendererOptions<Node, Element>['patchProp'] = (
4351
: // for normal html elements, set as a property if it exists
4452
key in el &&
4553
// except native onclick with string values
46-
!(nativeOnRE.test(key) && isString(nextValue))
54+
!(nativeOnRE.test(key) && isString(nextValue)))
4755
) {
4856
patchDOMProp(
4957
el,

0 commit comments

Comments
 (0)