From 931c0c4e88f17e678aa6d9939fbd251340849247 Mon Sep 17 00:00:00 2001 From: pimlie Date: Sat, 27 Jul 2019 17:49:20 +0200 Subject: [PATCH] refactor: optimize callback attribute --- src/server/generators/tag.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/server/generators/tag.js b/src/server/generators/tag.js index f92ed1d..dfbe826 100644 --- a/src/server/generators/tag.js +++ b/src/server/generators/tag.js @@ -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