From 969e8879f8a8489f301d4050a6c02ec46afa296c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Manuel=20Carrasco=20Mo=C3=B1ino?= Date: Sun, 3 Nov 2013 14:38:34 +0100 Subject: [PATCH] Use vendor names by default, otherwise certain chrome versions fail --- .../client/plugins/effects/Transitions.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 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 0a03b8ff..ec027133 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 @@ -147,7 +147,7 @@ public class Transitions extends GQuery { // Used to check supported properties in the browser private static Style divStyle = DOM.createDiv().getStyle(); - private static final String prefix = browser.msie ? "ms" : browser.opera ? "O" : browser.mozilla ? "Moz" : browser.webkit ? "Webkit" : ""; + private static final String prefix = browser.msie ? "ms" : browser.opera ? "o" : browser.mozilla ? "moz" : browser.webkit ? "webkit" : ""; private static final String transform = getVendorPropertyName("transform"); private static final String TRANSFORM = "_t_"; private static final String transformOrigin = getVendorPropertyName("transformOrigin"); @@ -168,6 +168,11 @@ public class Transitions extends GQuery { }); private static String getVendorPropertyName(String prop) { + // we prefer vendor specific names by default + String vendorProp = JsUtils.camelize("-" + prefix + "-" + prop); + if (JsUtils.hasProperty(divStyle, vendorProp)) { + return vendorProp; + } if (JsUtils.hasProperty(divStyle, prop)) { return prop; } @@ -175,16 +180,12 @@ public class Transitions extends GQuery { if (JsUtils.hasProperty(divStyle, camelProp)) { return camelProp; } - String vendorProp = prefix + camelProp; - if (JsUtils.hasProperty(divStyle, vendorProp)) { - return vendorProp; - } return null; } private static String property(String prop) { if (transformRegex.test(prop)) { - return "transform"; + return transform; } return prop.replaceFirst("^(margin|padding).+$", "$1"); } @@ -246,6 +247,8 @@ public class Transitions extends GQuery { if (m != null) { c = m; } + // chrome needs transition:-webkit-transform instead of transition:transform + c = JsUtils.hyphenize(c); if (!ret.contains(c)) { ret.add(c); } @@ -289,10 +292,8 @@ public class Transitions extends GQuery { // Use our override css method to set all props css(p); - // prevent memory leak removeData(TRANSFORM); - // restore oldTransitions in the element, and use the queue to prevent more effects being run. // TODO: Use transitionEnd events once GQuery supports non-bit events -- 2.39.5