【问题标题】:mojarra jsf api / impl 2.1.12 prints out css commentsmojarra jsf api / impl 2.1.12 打印出 css 注释
【发布时间】:2012-09-27 15:42:07
【问题描述】:

我将实现从 2.1.3 切换到 2.1.12 mojarry。 但现在我可以在任何 IE Explorer 中看到 CSS 开关 cmets:

    <!--[if lt IE 7]> <div style=' clear: both; text-align:center; padding:0 0 0 0px; position:         relative;'> <a href="http://www.microsoft.com/windows/internet-explorer/default.aspx?ocid=ie6_countdown_bannercode"><img  src="http://storage.ie6countdown.com/assets/100/../resources/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today. /></a> </div> <![endif]--> <!--[if lt IE 9]> <script type="text/javascript" src="js/html5.js"></script> <![endif]--> 

现在可见,而不是渲染它。 意味着,在我的源代码中,字符用 lt 和 gt 进行转义。 这来自 api 更改。有人有同样的经历吗? 谢谢!

【问题讨论】:

    标签: jsf mojarra


    【解决方案1】:

    您可以使用&lt;h:outputText escape="false"&gt; 以您想要的方式呈现它:

    <h:outputText value="&lt;!--[if lt IE 7]&gt;&lt;div&gt;...&lt;/div&gt;&lt;![endif]--&gt;" escape="false" />
    

    或者你可以使用OmniFaces &lt;o:conditionalComment&gt; 让它不那么可怕:

    <o:conditionalComment if="lt IE 7">
        <div>...</div>
    </o:conditionalComment>
    

    【讨论】:

    • 感谢 BalusC,这是一个选项,但不是它通常应该采用的方式。你能确认这是一个错误吗?谢谢和问候
    猜你喜欢
    • 2012-10-14
    • 2023-01-29
    • 2011-02-28
    • 2019-09-26
    • 1970-01-01
    • 2020-12-06
    • 2010-12-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多