summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorAdam Wagner <wbadam@users.noreply.github.com>2017-10-20 10:14:33 +0200
committerPéter Török <31210544+torok-peter@users.noreply.github.com>2017-10-20 11:14:33 +0300
commitdf2157ab9f39f7170675c8540a589cdc101d9456 (patch)
tree34fa8aa72c59813f656f73292dc43b09dd0f908e /client
parentcb85b628289d35619d512f519624e5b075dfc441 (diff)
downloadvaadin-framework-df2157ab9f39f7170675c8540a589cdc101d9456.tar.gz
vaadin-framework-df2157ab9f39f7170675c8540a589cdc101d9456.zip
Check class name type on Grid cell mouse over (#10194)
* Check whether className is of type string * Move string type checker method to widget util * Fix formatting of WidgetUtil * Break svg into lines
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/WidgetUtil.java13
-rwxr-xr-xclient/src/main/java/com/vaadin/client/widgets/Grid.java7
2 files changed, 19 insertions, 1 deletions
diff --git a/client/src/main/java/com/vaadin/client/WidgetUtil.java b/client/src/main/java/com/vaadin/client/WidgetUtil.java
index 94439dc945..e6304343aa 100644
--- a/client/src/main/java/com/vaadin/client/WidgetUtil.java
+++ b/client/src/main/java/com/vaadin/client/WidgetUtil.java
@@ -1867,6 +1867,19 @@ public class WidgetUtil {
}
/**
+ * Returns whether the given object is a string.
+ *
+ * @param obj
+ * the object of which the type is examined
+ * @return {@code true} if the object is a string; {@code false} if not
+ * @since
+ */
+ public static native boolean isString(Object obj)
+ /*-{
+ return typeof obj === 'string' || obj instanceof String;
+ }-*/;
+
+ /**
* Utility methods for displaying error message on components.
*
* @since 8.2
diff --git a/client/src/main/java/com/vaadin/client/widgets/Grid.java b/client/src/main/java/com/vaadin/client/widgets/Grid.java
index 43f85a9848..4651c534dc 100755
--- a/client/src/main/java/com/vaadin/client/widgets/Grid.java
+++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java
@@ -7528,7 +7528,12 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>,
boolean isElement = Element.is(n);
if (isElement) {
String className = Element.as(n).getClassName();
- if (className.contains(getStylePrimaryName() + "-spacer")) {
+
+ // Also check whether className is indeed a string. For
+ // SVGElement it may be of type SVGAnimatedString.
+ // https://developer.mozilla.org/en-US/docs/Web/API/Element/className#Notes
+ if (WidgetUtil.isString(className) && className
+ .contains(getStylePrimaryName() + "-spacer")) {
return true;
}
}