Feature request: Understand conditional comments

When using conditional comments to set a class on my web pages' html element, resharper ignores the tag within the comment and reports the error `Unmatched closing tag'.

Example of failing code:

<!--[if lt IE 7 ]><html lang="en-gb" ><![endif]--> <!--[if IE 7 ]><html lang="en-gb" ><![endif]--> <!--[if IE 8 ]><html lang="en-gb" ><![endif]--> <!--[if IE 9 ]><html lang="en-gb" ><![endif]--> <!--[if gt IE 9]><!--><html lang="en-gb"><!--<![endif]-->

Background: This has become best practice when making web pages. It is proposed by Paul Irish (http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/), and is in use in http://html5boilerplate.com/.
1 comment
Comment actions Permalink

+1 for that!

Your example is missing:

<!doctype html>
<!--[if lt IE 7]> <html lang="en"> <![endif]-->
<!--[if IE 7]>     <html lang="en"> <![endif]-->
<!--[if IE 8]>     <html lang="en"> <![endif]-->
<!--[if IE 9]>     <html lang="en"> <![endif]-->
<!--[if gt IE 9]><!--> <html lang="en"> <!--<![endif]-->
<head runat="server">

R# complains that "</html>" is an unmatched closing tag.


Please sign in to leave a comment.