]> source.dussan.org Git - vaadin-framework.git/commitdiff
Stop attempting to build dom path if reaching the root (#9534) 83/183/1
authorLeif Åstrand <leif@vaadin.com>
Tue, 30 Oct 2012 10:59:51 +0000 (12:59 +0200)
committerLeif Åstrand <leif@vaadin.com>
Tue, 30 Oct 2012 11:00:20 +0000 (13:00 +0200)
Change-Id: I5755bc292b9e752765086fcce8ce5edaa5300f34

client/src/com/vaadin/client/ComponentLocator.java

index 47fb29777c7329800eba65bf72c95e7424aaf7ce..d24b12ffe5c92d7fbd4b67e4afd17c5e431616e7 100644 (file)
@@ -19,6 +19,7 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
+import com.google.gwt.core.client.JavaScriptObject;
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.Element;
 import com.google.gwt.user.client.ui.HasWidgets;
@@ -371,14 +372,17 @@ public class ComponentLocator {
             path = PARENTCHILD_SEPARATOR + "domChild[" + childIndex + "]"
                     + path;
 
-            Element parent = e.getParentElement().cast();
+            JavaScriptObject parent = e.getParentElement();
+            if (parent == null) {
+                return null;
+            }
             // The parent check is a work around for Firefox 15 which fails to
             // compare elements properly (#9534)
             if (parent == baseElement) {
                 break;
             }
 
-            e = parent;
+            e = parent.cast();
         }
 
         return path;