Skip to content

unexpected formating in special IE conditional comment #5459

@fisker

Description

@fisker

Prettier 1.15.2
Playground link

Input:

<!DOCTYPE html>
<!--[if lt IE 9]><html class="legacy-ie"><![endif]-->
<!--[if gte IE 9]><!--><html><!--<![endif]-->
  <head></head>
  <body></body>
</html>

Output:

<!DOCTYPE html>
<!--[if lt IE 9]><html class="legacy-ie"><![endif]-->
<!-- [if gte IE 9]><! -->
<html>
  <!-- <![endif] -->
  <head></head>
  <body></body>
</html>

Expected behavior:

<!DOCTYPE html>
<!--[if lt IE 9]><html class="legacy-ie"><![endif]-->
<!--[if gte IE 9]><!--><html><!--<![endif]-->
  <head></head>
  <body></body>
</html>

I understand that in morden browser, 3rd line is considered as two normal comment, but it's still a IE conditional comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:htmlIssues affecting HTML (and SVG but not JSX)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.priority:highCode is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent!status:has prIssues with an accompanying pull request. These issues will probably be fixed soon!

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions