Fix #4686: if a CSX interpolation contains comments, not just inner CSX (JSX) tags, it needs to be wrapped in braces (#4689)

This commit is contained in:
Geoffrey Booth
2017-09-16 12:03:33 -07:00
committed by GitHub
parent 4c41831474
commit aecc115c79
3 changed files with 35 additions and 2 deletions

View File

@@ -3403,7 +3403,7 @@ exports.StringWithInterpolations = class StringWithInterpolations extends Base
else
fragments.push @makeCode '$' unless @csx
code = element.compileToFragments(o, LEVEL_PAREN)
unless @isNestedTag element
if not @isNestedTag(element) or code.some((fragment) -> fragment.comments?)
code = @wrapInBraces code
# Flag the `{` and `}` fragments as having been generated by this
# `StringWithInterpolations` node, so that `compileComments` knows