vue3-core/packages/runtime-dom/src/modules/attrs.ts

19 lines
440 B
TypeScript
Raw Normal View History

2020-01-29 07:48:27 +08:00
// TODO explain why we are no longer checking boolean/enumerated here
export function patchAttr(
el: Element,
key: string,
value: any,
isSVG: boolean
) {
if (isSVG && key.indexOf('xlink:') === 0) {
// TODO handle xlink
} else if (value == null) {
el.removeAttribute(key)
2018-09-19 23:35:38 +08:00
} else {
2020-01-29 07:48:27 +08:00
// TODO in dev mode, warn against incorrect values for boolean or
// enumerated attributes
el.setAttribute(key, value)
2018-09-19 23:35:38 +08:00
}
}