diff options
author | Manuel Carrasco Moñino <manuel.carrasco.m@gmail.com> | 2013-12-08 13:52:47 +0100 |
---|---|---|
committer | Manuel Carrasco Moñino <manuel.carrasco.m@gmail.com> | 2013-12-08 13:52:47 +0100 |
commit | ad6d295b486bf98576a7f6a462853eac88e46c5c (patch) | |
tree | 851b75040557ef51aa2675115e5e68f32d70ea5a | |
parent | 86ab53b16de6b4900512b8b1a93d6a6f6d859b10 (diff) | |
download | gwtquery-ad6d295b486bf98576a7f6a462853eac88e46c5c.tar.gz gwtquery-ad6d295b486bf98576a7f6a462853eac88e46c5c.zip |
Fix issue in chrome refusing to set transition css property when an invalid key is in the set
-rw-r--r-- | gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/Transitions.java | 14 |
1 files 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<String> filterPropertyNames(Properties p) { + private List<String> filterTransitionPropertyNames(Properties p) { List<String> ret = new ArrayList<String>(); 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<String> props = filterPropertyNames(p); + List<String> props = filterTransitionPropertyNames(p); String value = ""; for (String s : props) { value += (value.isEmpty() ? "" : ", ") + s + " " + attribs; |