From a7eefaff1ed8954cf36d9a2417538849d2d15445 Mon Sep 17 00:00:00 2001 From: Evan You Date: Sat, 12 Oct 2019 19:25:04 -0400 Subject: [PATCH] refactor(runtime-dom): remove xlink support since it's been deprecated --- packages/runtime-dom/src/modules/attrs.ts | 32 +++-------------------- packages/runtime-dom/src/patchProp.ts | 2 +- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/packages/runtime-dom/src/modules/attrs.ts b/packages/runtime-dom/src/modules/attrs.ts index 3254f0fcb..7bdd9ba68 100644 --- a/packages/runtime-dom/src/modules/attrs.ts +++ b/packages/runtime-dom/src/modules/attrs.ts @@ -1,31 +1,7 @@ -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, - value: any, - isSVG: boolean -) { - // isSVG short-circuits isXlink check - if (isSVG && isXlink(key)) { - if (value == null) { - el.removeAttributeNS(xlinkNS, getXlinkProp(key)) - } else { - el.setAttributeNS(xlinkNS, key, value) - } +export function patchAttr(el: Element, key: string, value: any) { + if (value == null) { + el.removeAttribute(key) } else { - if (value == null) { - el.removeAttribute(key) - } else { - el.setAttribute(key, value) - } + el.setAttribute(key, value) } } diff --git a/packages/runtime-dom/src/patchProp.ts b/packages/runtime-dom/src/patchProp.ts index 4c26b518d..a74faa88e 100644 --- a/packages/runtime-dom/src/patchProp.ts +++ b/packages/runtime-dom/src/patchProp.ts @@ -53,7 +53,7 @@ export function patchProp( unmountChildren ) } else { - patchAttr(el, key, nextValue, isSVG) + patchAttr(el, key, nextValue) } break }