Условные комментарии в приложении JSF отображаются в IE 8 и IE 9

У меня есть следующий код JSF 2.1.20

<!DOCTYPE html> 
<!--[if lt IE 7]>
<html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>
<html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>
<html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" 
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"><!--<![endif]-->

Это приводит к следующему коду (скопировано из инспектора Google Chrome)

<!DOCTYPE html><!--[if lt IE 7]&gt;
&lt;html class=&quot;no-js lt-ie9 lt-ie8 lt-ie7&quot;&gt; &lt;![endif]--><!--[if IE 7]&gt;
&lt;html class=&quot;no-js lt-ie9 lt-ie8&quot;&gt; &lt;![endif]--><!--[if IE 8]&gt;
&lt;html class=&quot;no-js lt-ie9&quot;&gt; &lt;![endif]--><!--[if gt IE 8]&gt;&lt;!-->
<html class="js"><!--&lt;![endif]-->

Не знаю, почему замедление xhtml не разрешается, а отображается. Тем не менее, он отлично работает в Chrome, Firefox и IE 10.

В инспекторе IE 8:

<!-- DOCTYPE html -->
<html class="js">
    <head>
        <style>CSS Stylesheet</style>
        <title>صفحة خطأ</title>


    <body class="bg-color white rtl" lang="ar">
        Text - <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--><!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--><!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
        <!-- [if gt IE 8]&gt;&lt;! -->      
        Text - Empty Text Node      
        <!-- &lt;![endif] -->

        <meta charset="utf-8"/>
        <meta http-equiv="X-UA-Compatible" content=" IE=edge,chrome=1"/>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
        <link href="/StaticFilesFiles/favicon.ico" rel="shortcut icon"/>
        <link href="/StaticFiles/css/styles.min.css" rel="stylesheet" type="text/css"/>
        Text - <!--[if IE 8]> <link type="text/css" rel="stylesheet" href="/StaticFiles/css/ie8_notification.css"/> <![endif]-->
        <script src="/StaticFiles/js/modernizr.min.js" type="text/javascript"></script>
        Text - Empty Text Node
        <!-- some comment -->

При просмотре исходного кода страницы IE8

<!DOCTYPE html>
<!--[if lt IE 7]&gt;
&lt;html class=&quot;no-js lt-ie9 lt-ie8 lt-ie7&quot;&gt; &lt;![endif]--><!--[if IE 7]&gt;
&lt;html class=&quot;no-js lt-ie9 lt-ie8&quot;&gt; &lt;![endif]--><!--[if IE 8]&gt;
&lt;html class=&quot;no-js lt-ie9&quot;&gt; &lt;![endif]--><!--[if gt IE 8]&gt;&lt;!--><html class="no-js" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<!--&lt;![endif]--><head>

        <title>صفحة خطأ</title>

        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content=" IE=edge,chrome=1" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

        <link rel="shortcut icon" href="/StaticFilesFiles/favicon.ico" />
        <link type="text/css" rel="stylesheet" href="/StaticFiles/css/styles.min.css" />        
        <!--[if IE 8]&gt;
            &lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;/StaticFiles/css/ie8_notification.css&quot;/&gt;
        &lt;![endif]-->

Использование параметра контекста пропуска комментариев с помощью фейслетов

<context-param>
    <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
    <param-value>true</param-value>
</context-param>

полностью стирает условные комментарии


person MHosafy    schedule 12.02.2015    source источник
comment
@BalusC: Что касается условных комментариев для тега <html class="">, можно ли предположить, что нет другого решения, кроме этой уродливой строки <h:outputText escape="false">, на которую вы ссылались в вопрос, который я продублировал ?   -  person MHosafy    schedule 16.02.2015