Is location of `HTMLClose` comment correct?
See original GitHub issuecomments = []; require('meriyah').parse('<!--\na\n-->', {onComment: comments, webcompat: true, ranges: true});comments
[
{ type: 'HTMLOpen', value: '', start: 0, end: 4, range: [ 0, 4 ] },
{ type: 'HTMLClose', value: '', start: 6, end: 10, range: [ 6, 10 ] }
]
We have [6, 10]
, while babel has [7, 10]
require('@babel/parser').parse('<!--\na\n-->').comments
[
{
type: 'CommentLine',
value: '',
start: 0,
end: 4,
loc: SourceLocation {
start: [Position],
end: [Position],
filename: undefined,
identifierName: undefined
}
},
{
type: 'CommentLine',
value: '',
start: 7,
end: 10,
loc: SourceLocation {
start: [Position],
end: [Position],
filename: undefined,
identifierName: undefined
}
}
]
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (9 by maintainers)
Top Results From Across the Web
The HTML Comment Tag: Here's How To Use It In Your Code »
Another thing you can do is put comments after closing tags, to help you find where a particular element ends. (This can be...
Read more >HTML Comments - W3Schools
HTML comments are not displayed in the browser, but they can help document your HTML source code. ... Comments can be used to...
Read more >How to Comment & Comment Out in HTML - HubSpot Blog
In HTML, a comment is text enclosed within < !╌ ╌> tags. This syntax tells the browser that they are comments and should...
Read more >is closing HTML comments without a -- delimiter
<br> first because the Markdown system doesn't care about your HTML comment. They're not allowed, so it doesn't search for the closing -->...
Read more >What are valid places to put HTML comments? - Stack Overflow
You can place comments between any tag, but not inside of a tag declaration. So, this is correct: <code><!
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 FreeTop 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
Top GitHub Comments
Your solution seems expensive? For this comment
for (/* comment 1 */;/* comment 2 */;/* comment 3 */);
. Calculate the spaces between(
and)
. Then use a code that can grab the comments in that range. You also need to calculate on leading and trailing.The point is too only attach the comments, right? So after you got that array returned, you attach the comment and use the range and source length and there you go ! 😃
I tweeted and mentioned you there. Anyway. Check your email. After that you can go to the /emitter folder where I’m playing around ATM. And also check out last part of the whitespace.ts file in the scanner folder.
I think that should answer your problems