Comments in template strings throw errors
See original GitHub issuebel`<div>
<!-- this is a comment -->
</div>`
Throws an InvalidCharacterError
since you can’t create an HTML comment via createElement
(but can through createComment
).
It would be awesome if bel either ignored comments or created them.
Happy to create a PR for either scenario
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Template literals (Template strings) - JavaScript | MDN
While technically permitted by the syntax, untagged template literals are strings and will throw a TypeError when chained.
Read more >BUG: Javascript Template literals (backticks) throws an error ...
Comments · zraly commented on May 30 · What version of astro are you using? · Are you using an SSR adapter? If...
Read more >Is it possible to have a comment inside a es6 Template-String?
Can you use comments in template literal strings? Yes. Yes you can. ... Not doing so will result in a runtime error. The...
Read more >tagged-template-literal-comments - npm
Adds comments to tagged template literals. Features. Removes commented out strings and values; Supports single line and multiline comments ...
Read more >String Interpolation in JavaScript - Dmitri Pavlutin
Inserting ${abc} directly throws an error because JavaScript interprets ${abc} as a placeholder.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve just submitted a pull request to hyperx with added support for comments: https://github.com/substack/hyperx/pull/44 I’ve also prepared a branch with support in bel: https://github.com/tornqvist/bel/tree/feature/comments
Awesome! Hope this gets merged soon 👍