mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-24 20:41:50 +03:00
Use data- for vmid to generate valid HTML
This commit is contained in:
@@ -37,6 +37,7 @@ export default function _updateTags (options = {}) {
|
|||||||
const newElement = document.createElement(type)
|
const newElement = document.createElement(type)
|
||||||
|
|
||||||
for (const attr in tag) {
|
for (const attr in tag) {
|
||||||
|
console.log(type, attribute, attr)
|
||||||
if (tag.hasOwnProperty(attr)) {
|
if (tag.hasOwnProperty(attr)) {
|
||||||
if (attr === 'innerHTML') {
|
if (attr === 'innerHTML') {
|
||||||
newElement.innerHTML = tag.innerHTML
|
newElement.innerHTML = tag.innerHTML
|
||||||
@@ -46,6 +47,10 @@ export default function _updateTags (options = {}) {
|
|||||||
} else {
|
} else {
|
||||||
newElement.appendChild(document.createTextNode(tag.cssText))
|
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 {
|
} else {
|
||||||
const value = (typeof tag[attr] === 'undefined') ? '' : tag[attr]
|
const value = (typeof tag[attr] === 'undefined') ? '' : tag[attr]
|
||||||
newElement.setAttribute(attr, value)
|
newElement.setAttribute(attr, value)
|
||||||
|
|||||||
Reference in New Issue
Block a user