Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-2232

Element#addClassName can create an additional new 'class' attribute

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 5.3.7
    • 5.4
    • tapestry-core
    • None

    Description

      When using Element#addClassName (in mixing enhancing component class), I noticed that I was getting two 'class' attributes in my element - rather than the one I was expecting. First I bumped into TAP5-708 and TAP5-804, which seem to fix only some part of the problem.

      Code in TAP5-804 will produce correct result and even the tests. But there is stil one situation, where there are two class attributes generated. Consider this code:

      Navbar.tml:
      <div class="navbar">
      ...
      </div>

      Code from mixin:
      element.addClassName("navbar-fixed-top")

      Produces this output:
      <div class="navbar-fixed-top" class="navbar">

      Problem is that SaxTemplateParser provides "" namespace and Element.addClassName will use null namespace, so another class attribute is added. Tests will pass, because Element.attribute provides null namespace. But I want to add another class name to one present in template.

      Interesting part of TAP5-708 is that supplied patch changed default namespace in Element.attribute and in Element.forceAttributes from null to "". So states event this comment: https://issues.apache.org/jira/browse/TAP5-708?focusedCommentId=12773672&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12773672. But this change is not present in source code.

      Attachments

        Activity

          People

            thiagohp Thiago Henrique De Paula Figueiredo
            matej.krchniak@softec.sk Matej Krchniak
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: