javaserverfaces-spec-public
  1. javaserverfaces-spec-public
  2. JAVASERVERFACES_SPEC_PUBLIC-974

Add support for conditional comments to h:outputStylesheet and h:outputScript (add condition attribute)

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.0, 2.1
    • Fix Version/s: None
    • Component/s: Resources
    • Labels:
      None
    • Status Whiteboard:
      Hide

      size_medium importance_medium

      Show
      size_medium importance_medium

      Description

      Conditional comments at wikipedia: http://en.wikipedia.org/wiki/Conditional_comment

      Example:

      <!--[if IE 6]>
      <link rel="stylesheet" type="text/css" href="style.css" />
      <![endif]-->

      This is currently not easy to achieve with facelets, because <!-- --> comments are normally stripped and JSF componentes inside comments also do not (really) work. However, working with styling frameworks, you have to use this quite heavily in order to support a variety of browsers.

      Thus I'd suggest to add a "condition" attribute to h:outputStylesheet and h:outputScript, which, if set, renders the conditional comment containing the value of the attribtue around the <link> or <script>.

      Example:

      <h:outputStylesheet name="style.css" condition="IE 6" />

      renders

      <!--[if IE 6]>
      <link rel="stylesheet" type="text/css" href="style.css" />
      <![endif]-->

        Activity

        Hide
        Manfred Riem added a comment -

        Closing resolved issue out

        Show
        Manfred Riem added a comment - Closing resolved issue out
        Hide
        Ed Burns added a comment -

        Out of scope for 2.3.

        Show
        Ed Burns added a comment - Out of scope for 2.3.
        Hide
        i_oss added a comment -

        Probably should be, but as we are discussing it here:

        How would you know that the useragent is IE6 (or 7 or so), the only safe way to find out is conditional comments.
        I think a better way would be to make (as you proposed) outputStylesheet or Script aware of IE* resources and just have it add conditional comments automatically for the additional resources no matter what useragent jsf thinks you have. How to do so, is part of the resource-management issues.

        Concerning h:comment: h: agreed!
        But I personally! still don't like the idea of having a condition and target attribute on a comment tag, I really think there should be a general (and easy) way to relocate component(-sub-trees) of any kind. (With the extended usage of meta (chrome plugin, iphone-settings, ...) we also need to be able to add this tag to the head, and probably be able to discover/remove them => h:meta anyone?)

        Show
        i_oss added a comment - Probably should be, but as we are discussing it here: How would you know that the useragent is IE6 (or 7 or so), the only safe way to find out is conditional comments. I think a better way would be to make (as you proposed) outputStylesheet or Script aware of IE* resources and just have it add conditional comments automatically for the additional resources no matter what useragent jsf thinks you have. How to do so, is part of the resource-management issues. Concerning h:comment: h: agreed! But I personally! still don't like the idea of having a condition and target attribute on a comment tag, I really think there should be a general (and easy) way to relocate component(-sub-trees) of any kind. (With the extended usage of meta (chrome plugin, iphone-settings, ...) we also need to be able to add this tag to the head, and probably be able to discover/remove them => h:meta anyone?)
        Hide
        Udo Schnurpfeil added a comment -

        An alternative for resources:

        The basic problem behind this resolution is that we want to have different resources for different browsers.
        I suggest to enhance the resource management to cover this issue.

        In short: resources should know for which browsers they are. If you have e.g. 2 files:

        • standard/style.css
        • ie6/style.css
          the tag
          <h:outputStylesheet name="style.css"/>
          should render one tag (if the browser is not ie6)
        • standard/style.css
          and two tags if the browser is ie6:
        • standard/style.css
        • ie6/style.css

        In the project Apache Tobago the resource mechanism works like this.

        This should be discussed in the resource management, of course. But when we have a simple to use <h:comment> (like my last comment) and a smart resource management, one can pick its preferred way.

        Show
        Udo Schnurpfeil added a comment - An alternative for resources: The basic problem behind this resolution is that we want to have different resources for different browsers. I suggest to enhance the resource management to cover this issue. In short: resources should know for which browsers they are. If you have e.g. 2 files: standard/style.css ie6/style.css the tag <h:outputStylesheet name="style.css"/> should render one tag (if the browser is not ie6) standard/style.css and two tags if the browser is ie6: standard/style.css ie6/style.css In the project Apache Tobago the resource mechanism works like this. This should be discussed in the resource management, of course. But when we have a simple to use <h:comment> (like my last comment) and a smart resource management, one can pick its preferred way.
        Hide
        Udo Schnurpfeil added a comment -

        Why not:

        <h:comment condition="..." target="...">
        <h:outputScript .... />
        </h:comment>

        Advantages in my opinion:

        • h: instead of ui: because it is a HTML feature, not a output independent feature.
        • easy to understand.
        • can be used with any other tags e. g. use <video> tag in HTML5 browsers and an special player tag in an other.
        • no need to change existing tags.
        Show
        Udo Schnurpfeil added a comment - Why not: <h:comment condition="..." target="..."> <h:outputScript .... /> </h:comment> Advantages in my opinion: h: instead of ui: because it is a HTML feature, not a output independent feature. easy to understand. can be used with any other tags e. g. use <video> tag in HTML5 browsers and an special player tag in an other. no need to change existing tags.

          People

          • Assignee:
            Unassigned
            Reporter:
            Jakob Korherr
          • Votes:
            7 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: