|
|
@@ -177,31 +177,31 @@ function getRuntimeHelper(
|
|
|
const tagName = tag.toUpperCase()
|
|
|
const isSVG = isSVGTag(tag)
|
|
|
|
|
|
- // 1. SVG: always attribute
|
|
|
- if (isSVG) {
|
|
|
- return extend({ isSVG: true }, helpers.setAttr)
|
|
|
- }
|
|
|
-
|
|
|
if (modifier) {
|
|
|
if (modifier === '.') {
|
|
|
- return getSpecialHelper(key, tagName) || helpers.setDOMProp
|
|
|
+ return getSpecialHelper(key, tagName, isSVG) || helpers.setDOMProp
|
|
|
} else {
|
|
|
- return helpers.setAttr
|
|
|
+ return isSVG ? extend({ isSVG: true }, helpers.setAttr) : helpers.setAttr
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 2. special handling for value / style / class / textContent / innerHTML
|
|
|
- const helper = getSpecialHelper(key, tagName)
|
|
|
+ // 1. special handling for value / style / class / textContent / innerHTML
|
|
|
+ const helper = getSpecialHelper(key, tagName, isSVG)
|
|
|
if (helper) {
|
|
|
return helper
|
|
|
}
|
|
|
|
|
|
- // 3. Aria DOM properties shared between all Elements in
|
|
|
+ // 2. Aria DOM properties shared between all Elements in
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/API/Element
|
|
|
if (/aria[A-Z]/.test(key)) {
|
|
|
return helpers.setDOMProp
|
|
|
}
|
|
|
|
|
|
+ // 3. SVG: always attribute
|
|
|
+ if (isSVG) {
|
|
|
+ return extend({ isSVG: true }, helpers.setAttr)
|
|
|
+ }
|
|
|
+
|
|
|
// 4. respect shouldSetAsAttr used in vdom and setDynamicProp for consistency
|
|
|
// also fast path for presence of hyphen (covers data-* and aria-*)
|
|
|
if (shouldSetAsAttr(tagName, key) || key.includes('-')) {
|
|
|
@@ -216,12 +216,14 @@ function getRuntimeHelper(
|
|
|
function getSpecialHelper(
|
|
|
keyName: string,
|
|
|
tagName: string,
|
|
|
+ isSVG: boolean,
|
|
|
): HelperConfig | undefined {
|
|
|
// special case for 'value' property
|
|
|
if (keyName === 'value' && canSetValueDirectly(tagName)) {
|
|
|
return helpers.setValue
|
|
|
} else if (keyName === 'class') {
|
|
|
- return helpers.setClass
|
|
|
+ // for svg, class should be set as attribute
|
|
|
+ return extend({ isSVG }, helpers.setClass)
|
|
|
} else if (keyName === 'style') {
|
|
|
return helpers.setStyle
|
|
|
} else if (keyName === 'innerHTML') {
|