JSF 2.1及更高版本IE条件注释 [英] JSF 2.1 & IE Conditional Comments

查看:218
本文介绍了JSF 2.1及更高版本IE条件注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到在JSF 2.1.*中,我的IE条件注释不再起作用. HTML实体&替换了各种字符.使注释语法无效. BalusC指出了另一个问题中的解决方案使用h:outputText.我的问题是,我希望在第一个元素周围的页面顶部显示条件注释.这意味着我不能使用h:outputText,因为我还没有定义它的命名空间.我相信这是正确的.这是一个代码示例.

I've noticed that in JSF 2.1.* my IE conditional comments are no longer working. Various characters are being replaced by HTML entities & invalidating the comment syntax. BalusC has pointed out a solution to the problem in another question which uses h:outputText. My problem is that I want my conditional comments at the top of my page, around the first element. This means that I can't use h:outputText as I haven't defined it's namespace yet. I believe that's correct anyway. Here's a code example.

当今大多数JSF页面将从类似于HTML5 Boilerplate语法的模板开始:

Most by JSF pages nowadays will start off with a template similar to the HTML5 Boilerplate syntax:

<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7 my-application" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8 my-application" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9 my-application" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js my-application" xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core" lang="en"><!--<![endif]-->
<h:head>
  <meta charset="utf-8" />
  ...

使用BalusC提到的解决方案,我希望在第2行上输入<h:outputText />,但尚未定义h名称空间.是我可以使用的元素,可以将各种名称空间附加到该元素,但不会影响最终的HTML吗?还有其他想法可以解决这个问题吗?

With BalusC's mentioned solution, I'd want <h:outputText /> on line 2 but the h namespace isn't defined yet. Is that an element I can use that I can attach the various namespaces to but won't affect my final HTML? Any other ideas how I can get round this issue?

推荐答案

将其全部包装在<f:view>中,并在其中定义名称空间.

Wrap it all in a <f:view> and define the namespaces there.

<!DOCTYPE html>
<f:view xmlns="http://www.w3.org/1999/xhtml" ...>
    ...
</f:view>

否则,整个JSF视图已经隐式包装在<f:view>中.

The entire JSF view is otherwise already implicitly wrapped in a <f:view>.

这篇关于JSF 2.1及更高版本IE条件注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆