Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
5.0.18
-
None
Description
When writing a mixin that uses Element#addClassName, I noticed that I was getting two 'class' attributes in my element - rather than the one I was expecting.
I've narrowed the problem down to a problem with how namespaces are used in Element and the following test case shows the problem. The "actual" output is:
<e class="a b" class="a" xmlns="http://www.w3.org/1999/xhtml"></e>
--------------------------------------
package test.com.db.fusion.iface.web.tapestry5.mixins;
import junit.framework.TestCase;
import org.apache.tapestry5.dom.DefaultMarkupModel;
import org.apache.tapestry5.dom.Document;
import org.apache.tapestry5.dom.Element;
public class AddClassNameTest extends TestCase {
public void test()
{ Document document = new Document(new DefaultMarkupModel()); Element element = document.newRootElement("http://www.w3.org/1999/xhtml", "e"); element.attribute("class", "a"); element.addClassName("b"); assertEquals("<e class=\"a b\" xmlns=\"http://www.w3.org/1999/xhtml\"></e>", element.toString()); }}
Attachments
Issue Links
- relates to
-
TAP5-708 Element.forceAttribute uses the element's namespace to match the attribute.
- Resolved