New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow parsing of HTML-like Comments #7802
Comments
You did not mention if this was in sloppy mode or module code, but note that <!--` in module code is not considered a comment start , but allowed in sloppy mode. |
I'm not strictly this, but I don't know that I'd call it a spec violation because it's part of Annex B, which is optional, and Babel has generally not handled that stuff. For instance, we definitely don't handle all of the old non-standard block-level function hoisting defined in annex B. I did file #5266 last year to track the possibility though. |
Personally, I'd I don't think we support support this or anything in Annex B - we never have and there's already enough issues that are way higher priority. We don't have to (not a browser) so we actually have the option not to (this is true for anything really). Basically I think we need to think about priority (code that is normally written/used), and there's plenty of that such that I don't see this happening unless this is a really good use case - if it's just a curiosity/completionist kind of view then I would ask that we not try to pursue this kind of thing? |
I noticed this has never been supported in acorn either. Off topic. I Looked at the lexer and noticed it possible to gain 3% perf boost. Move WS skipping to top of the switch and all other rare WS only validate them if hit max ascii chars - 128 and above. And only break the loop in the default clause. No ws skipping. |
Ok, I haven't realized that Babel doesn't support the Annex B (I don't think it's documented somewhere neither). First, I don't particularly care about allows HTML comments in Babel, it seems like a very uncommon use-case. Unlike the non-standard block-level function hoisting we can just parse it (and emit it again if needed). On the other hand, I think that it could be a good first issue for someone wanting to contribute to our parser/babel. |
We do support html comments in script mode. Till recently we did not allow them on the first line though: #9760 |
Choose one: is this a bug report or feature request?
Bug I guess
Input Code
Expected Behavior
undefined
Current Behavior
Possible Solution
Ignore it or update Babylon (it could be a good first issue?).
Context
Maybe some peoples are still using it?
Your Environment
See spec: B.1.3 HTML-like Comments
The text was updated successfully, but these errors were encountered: