Skip to content
This repository was archived by the owner on Oct 1, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
language: node_js
node_js:
- "8"
- "11"
cache:
yarn: true
directories:
- $HOME/.npm
- $HOME/.yarn-cache
- node_modules
branches:
only:
- master
node_js:
- "6"
before_install:
- npm i -g yarn --cache-min 999999999
install:
- yarn --force
- yarn install
script:
- yarn lint
- yarn test
after_script:
- yarn run codecov
after_success:
- yarn codecov
13 changes: 8 additions & 5 deletions src/server/generators/tagGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,20 @@ export default function _tagGenerator (options = {}) {
// grab child content from one of these attributes, if possible
const content = tag.innerHTML || tag.cssText || ''

// these tag types will have content inserted
const closed = ['noscript', 'script', 'style'].indexOf(type) === -1

// generate tag exactly without any other redundant attribute
const observeTag = tag.once
? ''
: `${attribute}="true" `

// these tags have no end tag
const hasEndTag = !['base', 'meta', 'link'].includes(type)

// these tag types will have content inserted
const hasContent = hasEndTag && ['noscript', 'script', 'style'].includes(type)

// the final string for this specific tag
return closed
? `${tagsStr}<${type} ${observeTag}${attrs}/>`
return !hasContent
? `${tagsStr}<${type} ${observeTag}${attrs}${hasEndTag ? '/' : ''}>`
: `${tagsStr}<${type} ${observeTag}${attrs}>${content}</${type}>`
}, '')
}
Expand Down