I think I may have found a GWT bug.  Please let me know if there is a
better place to post this...

   Consider this code from a JSTL tag…

------------------------
<div id="existingFriendsAddressBook">
        <ul>
                <c:forEach items="${friends}" var="friend">
                        <c:set 
var="friendEmail">${fn:toLowerCase(friend.email)}</c:set>
                        <li>
                                <input type="checkbox" 
id="existingFriend_${friendEmail}" /> $
{friendEmail}
                        </li>
                </c:forEach>
        </ul>
</div>
------------------------

   …and this GWT code, which tries to get a reference to each of the
checkboxes created in that tag…

------------------------
@Override
protected void build() {
        DivElement existingFriendsAddressBook =
                DivElement.as(DOM.getElementById
("existingFriendsAddressBook"));
        UListElement list =
                UListElement.as
(existingFriendsAddressBook.getFirstChildElement());
        NodeList<Node> children = list.getChildNodes();
        int numFriends = children.getLength();
        for (int i = 0; i < numFriends; i++) {
                LIElement row = LIElement.as((Element) children.getItem(i));
                Element firstChild = row.getFirstChildElement();
                InputElement checkbox = InputElement.as(firstChild);
                String checkboxId = checkbox.getId();
                [do stuff with checkboxId, unrelated to this post]
        }
}
------------------------

   It turns out that IN FIREFOX ONLY, the variable “firstChild” is
null, and I believe this is a bug in Element’s getFirstChildElement
().  I changed the code to the following, and there is no longer an
error…

------------------------
LIElement row = LIElement.as((Element) children.getItem(i));
NodeList<Node> subchildren = row.getChildNodes();
InputElement checkbox = InputElement.as((Element) subchildren.getItem
(0));
String checkboxId = checkbox.getId();
------------------------

A call to GWT.getVersion() returns "1.5.2"

As you can see, I have found a work-around, so this isn't urgent...
just a heads-up! :)

-Monkey Mike

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to