2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-19 09:30:33 +03:00

fix: use empty string value for boolean attributes on client side (fixes #381)

This commit is contained in:
pimlie
2019-06-07 09:58:32 +02:00
parent a31877c991
commit eb4980c9de
2 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -1,3 +1,4 @@
import { booleanHtmlAttributes } from '../../shared/constants'
import { isUndefined } from '../../utils/is-type'
import { toArray, includes } from '../../utils/array'
@@ -51,7 +52,7 @@ export default function updateTag(appId, { attribute, tagIDKeyName } = {}, type,
const _attr = includes(dataAttributes, attr)
? `data-${attr}`
: attr
const value = isUndefined(tag[attr]) ? '' : tag[attr]
const value = isUndefined(tag[attr]) || booleanHtmlAttributes.includes(attr) ? '' : tag[attr]
newElement.setAttribute(_attr, value)
}
}