jsf 2 - Browser-dependent CSS switch with JSF -
i need browser specific css in jsf2 application (mojarra 2.1, tomcat 7).
i tried adding template:
<!--[if ie 8]> <link rel="stylesheet" type="text/css" href="#{cfgs.externalcssurlie8}" /> <![endif]-->
but comments not rendered since use:
<context-param> <!-- removes comments rendered html pages. --> <param-name>javax.faces.facelets_skip_comments</param-name> <param-value>true</param-value> </context-param>
my problem... when disable `javax.faces.facelets_skip_comments, bunch of other problems.. don't think source-code comments belong generated pages.
i tried put switch in cdata like:
<![cdata[ <!--[if ie 7]> <link rel="stylesheet" type="text/css" href="#{cfgs.externalcssurlie7}" /> <![endif]--> ]]>
but inner < rendered html entities.. :-/, not working.
question: there other solution? jsf2 tag exist handle this? external tag libraries?
thanks in advance, steve
the way using <h:outputtext escape="false">
.
<h:outputtext value="<!--[if ie 8]><link rel="stylesheet" type="text/css" href="#{cfgs.externalcssurlie8}" /><![endif]-->" escape="false" />
yes, line of ugliness. there's no other standard way.
update: jsf utility library omnifaces offers <o:conditionalcomment>
purpose don't need ugly <h:outputtext escape="false">
anymore:
<o:conditionalcomment if="ie 8"> <link rel="stylesheet" type="text/css" href="#{cfgs.externalcssurlie8}" /> </o:conditionalcomment>
Comments
Post a Comment