After hours of GWT and Errai code debugging I've found what I think it is a Bug in the code.
I was trying to use ListWidget to create and paint <TR> like items... and trying to find out what fails in this kind of code, I arrived to TemplateUtil class where in the method:
private static Element firstNonMetaElement(final Element parserDiv) { Element displayable = parserDiv.getFirstChildElement(); while (displayable != null && displayable.getTagName().equalsIgnoreCase("meta")) { displayable = displayable.getNextSiblingElement(); } return displayable; }
We are using the Element objects "getFirstChildElement" method which has this code:
/** * The first child of element this element. If there is no such element, this * returns null. */ public final Element getFirstChildElement() { return DOMImpl.impl.getFirstChildElement(this); }
And finally uses this native method:
public native Element getFirstChildElement(Element elem) /*-{ var child = elem.firstChild; while (child && child.nodeType != 1) child = child.nextSibling; return child; }-*/;
What I see in this method is that the code is using firstChild which is not a Element type object... It is a Text Object.
So if what I think it's true child.nodeType will never return a 1... cause never is going to be a Element type object. It will retun a 3 and will keep looking for "siblings" till child is null.
This way it is not returning the firstChildElement to the TemplateUtil making it fail.
This is a resume of what I found, I'd love someone to confirm my theory or tell me what did I undestand wrong.