diff --git a/src/runtime/vdom/set-accessor.ts b/src/runtime/vdom/set-accessor.ts index 9b2e52d8c53..3923846d4ec 100644 --- a/src/runtime/vdom/set-accessor.ts +++ b/src/runtime/vdom/set-accessor.ts @@ -84,13 +84,14 @@ export const setAccessor = (elm: HTMLElement, memberName: string, oldValue: any, // Set property if it exists and it's not a SVG const isProp = isMemberInElement(elm, memberName); const isComplex = isComplexType(newValue); - const isCustomElement = elm.tagName.includes('-'); if ((isProp || (isComplex && newValue !== null)) && !isSvg) { try { - if (!isCustomElement) { - newValue = newValue == null ? '' : newValue; - if ((elm as any)[memberName] !== newValue) { - (elm as any)[memberName] = newValue; + if (!elm.tagName.includes('-')) { + const n = newValue == null ? '' : newValue; + + // Workaround for Safari, moving the caret when re-assigning the same valued + if ((elm as any)[memberName] !== n) { + (elm as any)[memberName] = n; } } else { (elm as any)[memberName] = newValue; @@ -98,6 +99,7 @@ export const setAccessor = (elm: HTMLElement, memberName: string, oldValue: any, } catch (e) {} } + /** * Need to manually update attribute if: * - memberName is not an attribute