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

Html conditional comment - opening and closing in two tags #30

Open
dios1101 opened this issue Sep 21, 2016 · 1 comment
Open

Html conditional comment - opening and closing in two tags #30

dios1101 opened this issue Sep 21, 2016 · 1 comment
Assignees

Comments

@dios1101
Copy link

dios1101 commented Sep 21, 2016

Code below brokes when minified. Html conditional comments in two comment tags (opening and closing) not working.

Example of not supported html :

<!--[if !IE]><!-->
<html lang="fr">
<!--<![endif]-->

More complex example:

<!DOCTYPE html>
<!--[if IE 8]> <html lang="fr" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="fr" class="ie9"> <![endif]-->
<!--[if !IE]><!-->
<html lang="fr">
<!--<![endif]-->

....
@nevaldas
Copy link

Solution I have used is correcting the HTML comment regex to this (notice the |<!|> in the first bracket):
<!--(?!\[|<!|>)(.*?)-->
and to this if you ignore knockout comments:
<!--(?!\[|<!|>)(?!ko .*)(?!\/ko)(.*?)-->

@deanhume deanhume self-assigned this Oct 16, 2019
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

3 participants