1
+ import { tagsWithoutEndTag , tagsWithInnerContent , tagAttributeAsInnerContent } from '../../shared/constants'
2
+
1
3
/**
2
4
* Generates meta, base, link, style, script, noscript tags for use on the server
3
5
*
@@ -21,7 +23,7 @@ export default function tagGenerator({ attribute, tagIDKeyName } = {}, type, tag
21
23
// build a string containing all attributes of this tag
22
24
const attrs = Object . keys ( tag ) . reduce ( ( attrsStr , attr ) => {
23
25
// these attributes are treated as children on the tag
24
- if ( [ 'innerHTML' , 'cssText' , 'once' ] . includes ( attr ) ) {
26
+ if ( tagAttributeAsInnerContent . includes ( attr ) || attr === 'once' ) {
25
27
return attrsStr
26
28
}
27
29
@@ -45,10 +47,10 @@ export default function tagGenerator({ attribute, tagIDKeyName } = {}, type, tag
45
47
: `${ attribute } ="true"`
46
48
47
49
// these tags have no end tag
48
- const hasEndTag = ! [ 'base' , 'meta' , 'link' ] . includes ( type )
50
+ const hasEndTag = ! tagsWithoutEndTag . includes ( type )
49
51
50
52
// these tag types will have content inserted
51
- const hasContent = hasEndTag && [ 'noscript' , 'script' , 'style' ] . includes ( type )
53
+ const hasContent = hasEndTag && tagsWithInnerContent . includes ( type )
52
54
53
55
// the final string for this specific tag
54
56
return ! hasContent
0 commit comments