summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-09-18 16:20:56 +0300
committerArtur Signell <artur@vaadin.com>2012-09-18 16:20:56 +0300
commit7aafd30a4d2e9c969220e47012d809aeb652f7e8 (patch)
tree9b9abeef8fca25b74522d972f245fb7d45731e9c /client
parent84449d07b0e637ce16cc3d6cde2ec7113130f281 (diff)
downloadvaadin-framework-7aafd30a4d2e9c969220e47012d809aeb652f7e8.tar.gz
vaadin-framework-7aafd30a4d2e9c969220e47012d809aeb652f7e8.zip
Workaround for Firefox 15 element comparsion issue (#9534)
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ComponentLocator.java33
1 files changed, 16 insertions, 17 deletions
diff --git a/client/src/com/vaadin/client/ComponentLocator.java b/client/src/com/vaadin/client/ComponentLocator.java
index 1852b67260..8f72fe7289 100644
--- a/client/src/com/vaadin/client/ComponentLocator.java
+++ b/client/src/com/vaadin/client/ComponentLocator.java
@@ -176,7 +176,11 @@ public class ComponentLocator {
return null;
}
- if (w.getElement() == targetElement) {
+ // The parent check is a work around for Firefox 15 which fails to
+ // compare elements properly (#9534)
+ if (w.getElement() == targetElement
+ || (w.getElement().getParentElement() == targetElement
+ .getParentElement())) {
/*
* We are done if the target element is the root of the target
* widget.
@@ -316,28 +320,23 @@ public class ComponentLocator {
Element e = element;
String path = "";
while (true) {
- Element parent = DOM.getParent(e);
- if (parent == null) {
- return null;
- }
-
int childIndex = -1;
-
- int childCount = DOM.getChildCount(parent);
- for (int i = 0; i < childCount; i++) {
- if (e == DOM.getChild(parent, i)) {
- childIndex = i;
- break;
- }
- }
- if (childIndex == -1) {
- return null;
+ Element siblingIterator = e;
+ while (siblingIterator != null) {
+ childIndex++;
+ siblingIterator = siblingIterator.getPreviousSiblingElement()
+ .cast();
}
path = PARENTCHILD_SEPARATOR + "domChild[" + childIndex + "]"
+ path;
- if (parent == baseElement) {
+ Element parent = e.getParentElement().cast();
+ // The parent check is a work around for Firefox 15 which fails to
+ // compare elements properly (#9534)
+ if (parent == baseElement
+ || parent.getParentElement() == baseElement
+ .getParentElement()) {
break;
}