Skip to content

Commit

Permalink
fix: support once (with skip) client side (fix #498)
Browse files Browse the repository at this point in the history
  • Loading branch information
pimlie committed Feb 26, 2020
1 parent 4c03b38 commit c74c645
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/client/updaters/tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion src/shared/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down

0 comments on commit c74c645

Please sign in to comment.