Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-6546

CssContentHeaderItem comments CSS code with HTML comments

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 6.24.0, 6.29.0
    • Fix Version/s: 8.0.0, 7.11.0
    • Component/s: wicket
    • Labels:
      None

      Description

      CssContentHeaderItem wraps the passed CSS in HTML comments thus rendering invalid markup.

      Example code:

       

      @Override
      public void renderHead(Component component, IHeaderResponse response) {
         super.renderHead(component, response);
         response.render(CssContentHeaderItem.forCSS(".select2-container--open {z-index: 100000;}", "select2-mod", ""));
      }
      

      Renders:

       

      <style type="text/css" id="select2-mod">
      <!-- .select2-container--open {z-index: 100000;}-->
      </style>

      The HTML comments in the CSS make the response invalid and in the browser you get a XML Parsing Error - Not Well Formed.

       

      It should not render this invalid html comments in CSS.

      Looking at the source code i think the error is in the CssUtils class: https://github.com/apache/wicket/blob/wicket-6.x/wicket-core/src/main/java/org/apache/wicket/core/util/string/CssUtils.java

       

        Attachments

        1. wicket6546 (2).zip
          24 kB
          Robert Niestroj

          Issue Links

            Activity

              People

              • Assignee:
                solomax Maxim Solodovnik
                Reporter:
                rniestroj Robert Niestroj
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: