From c74c645d1881e22569a2ea7ac0c903a4f6ee2243 Mon Sep 17 00:00:00 2001 From: pimlie Date: Wed, 26 Feb 2020 19:32:19 +0100 Subject: [PATCH] fix: support once (with skip) client side (fix #498) --- src/client/updaters/tag.js | 5 ++++- src/shared/constants.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/client/updaters/tag.js b/src/client/updaters/tag.js index 34916180..76caefa3 100644 --- a/src/client/updaters/tag.js +++ b/src/client/updaters/tag.js @@ -44,7 +44,10 @@ export default function updateTag (appId, options, type, tags, head, body) { } const newElement = document.createElement(type) - newElement.setAttribute(attribute, appId) + + if (!tag.once) { + newElement.setAttribute(attribute, appId) + } Object.keys(tag).forEach((attr) => { /* istanbul ignore next */ diff --git a/src/shared/constants.js b/src/shared/constants.js index 539d56a5..4626ad99 100644 --- a/src/shared/constants.js +++ b/src/shared/constants.js @@ -104,7 +104,7 @@ export const tagsWithInnerContent = ['noscript', 'script', 'style'] // Attributes which are inserted as childNodes instead of HTMLAttribute export const tagAttributeAsInnerContent = ['innerHTML', 'cssText', 'json'] -export const tagProperties = ['once', 'template'] +export const tagProperties = ['once', 'skip', 'template'] // Attributes which should be added with data- prefix export const commonDataAttributes = ['body', 'pbody']