Skip to content
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

HTMLLexer: conditional comments #4350

Open
HubertKauker opened this issue Dec 6, 2024 · 0 comments
Open

HTMLLexer: conditional comments #4350

HubertKauker opened this issue Dec 6, 2024 · 0 comments

Comments

@HubertKauker
Copy link

HubertKauker commented Dec 6, 2024

Hi all.

HTMLLexer.g4 contains a rule HTML_CONDITIONAL_COMMENT: '<![' .*? ']>'; . The standard does not "officially" use a term such as a "conditional comment". Other sources of wisdom like Wikipedia know that conditional html comments were invented by Microsoft Internet Explorer and come in two kinds.

A hidden comment: <!--[ .*? ]--> is just a special case of a normal html comment with additional brackets.

On the other hand, Microsoft invented "revealed" (pseudo-)comments, which are not comments at all, but just plain invalid html like

<![if !IE]>
    <link href="non-ie.css" rel="stylesheet">
<![endif]>

Is it ok that such syntax is part of the lexer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant