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

refactor: optimize callback attribute

This commit is contained in:
pimlie
2019-07-27 17:49:20 +02:00
committed by Pim
parent 0bf0ceb756
commit 931c0c4e88
+6 -6
View File
@@ -14,7 +14,7 @@ import {
* @return {Object} - the tag generator
*/
export default function tagGenerator ({ ssrAppId, attribute, tagIDKeyName } = {}, type, tags) {
const dataAttributes = [tagIDKeyName, 'callback', ...commonDataAttributes]
const dataAttributes = [tagIDKeyName, ...commonDataAttributes]
return {
text ({ body = false, pbody = false } = {}) {
@@ -43,17 +43,17 @@ export default function tagGenerator ({ ssrAppId, attribute, tagIDKeyName } = {}
continue
}
if (attr === 'callback') {
attrs += ` onload="this.__vm_l=1"`
continue
}
// these form the attribute list for this tag
let prefix = ''
if (dataAttributes.includes(attr)) {
prefix = 'data-'
}
if (attr === 'callback') {
attrs += ` onload="this.__vm_l=1"`
continue
}
const isBooleanAttr = !prefix && booleanHtmlAttributes.includes(attr)
if (isBooleanAttr && !tag[attr]) {
continue