JSF2.1.7 renders <!--[if IE ]> tag as text
Asked Answered
A

2

3

We upgraded our JSF to latest version 2.1. previously we were in JSF2.0.4. Our xhtml pages has Targeting IE Using Conditional Comments tag,which were not rendered as text.

But with new JSF2.1.7 this is being rendered as text in IE . Any ideas how to get around this issue?

Actinology answered 17/4, 2012 at 16:36 Comment(0)
N
5

Use <h:outputText escape="false"> instead.

<h:outputText value="&lt;!--[if IE]&gt;&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;ie.css&quot;/&gt;&lt;![endif]--&gt;" escape="false" />
Necklace answered 17/4, 2012 at 17:0 Comment(3)
Sorry, can't answer that from top of head right now. We always use javax.faces.FACELETS_SKIP_COMMENTS. The symptoms at least indicate that rendering of comments has been changed to not interpret any enclosed HTML/JSF code inside comments anymore (which makes sense, of course).Necklace
Ugly solution but looks like it's the only possible way.Gregg
Since shortly, OmniFaces provides a <o:conditionalComment> component for the purpose which is less ugly. See also the showcase: showcase.omnifaces.org/components/conditionalCommentNecklace
J
0

You can do something like this:

<f:verbatim>
  <!--[if lte IE 8]>
    <script src="js/conditional-comment.js"></script>
  <![endif]-->
</f:verbatim>
Jacobjacoba answered 17/10, 2012 at 12:37 Comment(1)
The <f:verbatim> is deprecated since JSF 2.0.Necklace

© 2022 - 2024 — McMap. All rights reserved.