OmniFaces conditionalComment not written to HTML output

偶尔善良 提交于 2019-12-02 00:33:43
BalusC

This problem is two-fold:

  1. The <f:facet name="last"> makes no sense in this context. Get rid of it. It would be ignored including any of its children. It's only valid inside <h:head> (and even then only if you're using PrimeFaces; who actually overlooked the native JSF possibility to order head resources as last).

  2. You can't use <h:outputScript> (nor <h:outputStylesheet> inside <o:conditionalComment>, because JSF will implicitly auto-relocate it to the <head>. This is also hinted in the documentation and showcase.

Just use plain vanilla <script> (or <link rel="stylesheet">).

<o:conditionalComment if="(gte IE 6)&amp;(lte IE 8)">
    <script src="#{resource['js/selectivizr-min.js']}" />
</o:conditionalComment>

Note that I fixed the invalid if attribute value by removing the duplicated if.


Unrelated to the concrete problem: The library="js" indicates a misunderstanding of the library attribute. Carefully read What is the JSF resource library for and how should it be used? The #{resource} resolver in above answer has already been altered to use js as regular folder instead of as library.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!