From ad6d295b486bf98576a7f6a462853eac88e46c5c Mon Sep 17 00:00:00 2001 From: Manuel Carrasco MoƱino Date: Sun, 8 Dec 2013 13:52:47 +0100 Subject: Fix issue in chrome refusing to set transition css property when an invalid key is in the set --- .../gwt/query/client/plugins/effects/Transitions.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/Transitions.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/Transitions.java index 0de39ad3..e1479ad1 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/Transitions.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/Transitions.java @@ -96,8 +96,8 @@ public class Transitions extends GQuery { } public void setFromString(String prop, String ...val) { - if (val.length == 1 && val[0] instanceof String) { - String[] vals = ((String)val[0]).split("[\\s*,\\s*]"); + if (val.length == 1) { + String[] vals = val[0].split("[\\s*,\\s*]"); set(prop, vals); } else { set(prop, val); @@ -166,6 +166,9 @@ public class Transitions extends GQuery { protected static final RegExp transformRegex = RegExp.compile("^(scale|translate|rotate([XY]|3d)?|perspective|skew[XY]|x|y)$"); protected static final String transition = getVendorPropertyName("transition"); + // passing an invalid transition property in chrome, makes disable all transitions in the element + private static final RegExp invalidTransitionNamesRegex = RegExp.compile("^(.*transform.*|duration|easing|clip-.*)$"); + private static final String transitionDelay = getVendorPropertyName("transitionDelay"); private static final String transitionEnd = browser.mozilla || browser.msie ? "transitionend" : (prefix + "transitionEnd"); @@ -254,9 +257,12 @@ public class Transitions extends GQuery { return this; } - private List filterPropertyNames(Properties p) { + private List filterTransitionPropertyNames(Properties p) { List ret = new ArrayList(); for (String s : p.keys()) { + if (invalidTransitionNamesRegex.test(s)) { + continue; + } String c = JsUtils.camelize(s); // marginLeft, marginRight ... -> margin String m = property(c); @@ -311,7 +317,7 @@ public class Transitions extends GQuery { } String attribs = duration + "ms" + " " + easing.toString() + " " + delay + "ms"; - List props = filterPropertyNames(p); + List props = filterTransitionPropertyNames(p); String value = ""; for (String s : props) { value += (value.isEmpty() ? "" : ", ") + s + " " + attribs; -- cgit v1.2.3