2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-05-30 08:14:05 +03:00

Merge pull request #90 from any35/master

In some case, we do need a clean tag without any other redundancy attributes.
This commit is contained in:
Sébastien Chopin
2017-05-12 17:14:05 +02:00
committed by GitHub
+8 -2
View File
@@ -19,6 +19,7 @@ export default function _tagGenerator (options = {}) {
// these attributes are treated as children on the tag
case 'innerHTML':
case 'cssText':
case 'once':
return attrsStr
// these form the attribute list for this tag
@@ -35,10 +36,15 @@ export default function _tagGenerator (options = {}) {
// these tag types will have content inserted
const closed = ['noscript', 'script', 'style'].indexOf(type) === -1
// generate tag exactly without any other redundance attribute
const observeTag = tag.once
? ''
: `${attribute}="true" `
// the final string for this specific tag
return closed
? `${tagsStr}<${type} ${attribute}="true" ${attrs}/>`
: `${tagsStr}<${type} ${attribute}="true" ${attrs}>${content}</${type}>`
? `${tagsStr}<${type} ${observeTag}${attrs}/>`
: `${tagsStr}<${type} ${observeTag}${attrs}>${content}</${type}>`
}, '')
}
}