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

Use data- for vmid to generate valid HTML

This commit is contained in:
Sebastien Chopin
2017-05-15 14:24:05 +02:00
parent cf5c55f068
commit 81915c4abf
+5
View File
@@ -37,6 +37,7 @@ export default function _updateTags (options = {}) {
const newElement = document.createElement(type)
for (const attr in tag) {
console.log(type, attribute, attr)
if (tag.hasOwnProperty(attr)) {
if (attr === 'innerHTML') {
newElement.innerHTML = tag.innerHTML
@@ -46,6 +47,10 @@ export default function _updateTags (options = {}) {
} else {
newElement.appendChild(document.createTextNode(tag.cssText))
}
} else if (attr === options.tagIDKeyName) {
const _attr = `data-${attr}`
const value = (typeof tag[attr] === 'undefined') ? '' : tag[attr]
newElement.setAttribute(_attr, value)
} else {
const value = (typeof tag[attr] === 'undefined') ? '' : tag[attr]
newElement.setAttribute(attr, value)