Skip to content

Commit

Permalink
Use data- for vmid to generate valid HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Chopin committed May 15, 2017
1 parent cf5c55f commit 81915c4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/client/updaters/updateTags.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 81915c4

Please sign in to comment.