Allow html conditional comments and doctype
See original GitHub issueI’m hacking on an fully server and client compatible app using React. One obstactle I’m running into is it seems react doesn’t like exclamation marks in your jsx-style code.
Here’s an example of a pretty standard boilerplate for HTML:
<!doctype html>
<!--[if IE 7]> <html class="no-js ie ie7 ltie8 ltie9"><![endif]-->
<!--[if IE 8]> <html class="no-js ie ie8 ltie9"><![endif]-->
<!--[if gt IE 8]> <html class="no-js ie gtie8"><![endif]-->
<!--[if !IE]><!--><html class="no-js" xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml" ><!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/css/app.css" type="text/css" media="all" />
</head>
<body>
<!--[if lt IE 8]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
{this.props.page}
<!-- <script src="/js/vendor.js"></script> -->
<script src="/js/app.js"></script>
</body>
</html>
I think it’s getting stuck on the conditional comments in this example.
I would prefer to keep this code in the HTML style, and to render it from the server without making major changes, it needs to be inside a react class. I’d be open to trying to hack this together, I may take a stab sometime this coming week.
Issue Analytics
- State:
- Created 10 years ago
- Reactions:11
- Comments:56 (19 by maintainers)
Top Results From Across the Web
conditional comments in html - css - Stack Overflow
Browsers other than IE treat the conditional statements as comments because they're enclosed inside comment tags.
Read more >Conditional Comments - HTML Dog
This web site currently uses conditional comments to make a handful of amendments for IE 8 and below, including a small extra stylesheet,...
Read more >Conditional Comments | Scott Granneman
The conditional comments starts & ends with standard HTML comment syntax: <!-- & --> . Every web browser except IE will see that...
Read more >What is HTML comment - HTML tutorials - w3resource
1. Conditional comments are conditional statements to hide or provide HTML source code from Internet Explorer. 2. There are two types of ...
Read more >Why “Conditional Comments” Are Bad, Repeat: Bad
Conditional Comments guarantee your HTML to be changed, because they mix to-be-separated structure and presentation.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
While this is true it sucks for people who want to do full-page server rendering. I think if we claim to support full-page server rendering we should at least support doctype.
Hi!
I have found a new method to include HTML comments (e.g. conditional IE comments) in JSX and React components using a Web Component.
https://github.com/optimalisatie/react-jsx-html-comments