question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Comments in template strings throw errors

See original GitHub issue
bel`<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:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tornqvistcommented, Feb 18, 2017

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

0reactions
jorgebucarancommented, Feb 18, 2017

Awesome! Hope this gets merged soon 👍

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found