• Post Reply Bookmark Topic Watch Topic
  • New Topic

Not familiar with this syntax  RSS feed

 
M Burke
Ranch Hand
Posts: 406
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a JSP I am working on, I see this...

<!--[if IE]>

<![endif]-->

What language is this? Also, IE 10 does not recognize it.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look closely at the syntax, you'll see that's just an HTML comment. All browsers but IE just ignore it as a comment.

IE parses the comment and treats it as a conditional. It's completely non-standard.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another variant you might come across (this comes from HTML5 Boilerplate):


Again notice how it's just a comment that will be ignored non-IE browsers.
 
M Burke
Ranch Hand
Posts: 406
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see, thank you. I will change it to JSTL's c:if
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why? If it works, why upset the apple cart?
 
Pavel Sok
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Such HTML statement is used in creating forks during the parsing web page by browsers. So use this instead of propagating unnecessary JSTL's tags.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!