]> source.dussan.org Git - gwtquery.git/commitdiff
- Select the appropriate DocumentStyleImpl and Selectors for ie8 in .gwt.xml.
authorManolo Carrasco <manolo@apache.org>
Sun, 13 Jun 2010 12:24:42 +0000 (12:24 +0000)
committerManolo Carrasco <manolo@apache.org>
Sun, 13 Jun 2010 12:24:42 +0000 (12:24 +0000)
- Do not change overflow when it is not a resize animation
- Restore correctly attibutes in show/hide animations
- Restored the parameter force in css and curCSS methods
- Changed the way show sets the display property in order to use block only when it is needed
- change the parameter order of the setStyleProperty method

gwtquery-core/src/main/java/com/google/gwt/query/Query.gwt.xml
gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java
gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java
gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImplIE.java
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/PropertiesAnimation.java
gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java
gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEffectsTest.java
samples/pom.xml
samples/src/main/java/gwtquery/samples/client/GwtQueryEffectsModule.java
samples/src/main/java/gwtquery/samples/public/GwtQueryBench.html
samples/src/main/java/gwtquery/samples/public/GwtQueryEffects.html

index 9d0e83ff6bdf693497867eb55376f64617914e29..6f3cb86304d53f20ee64e813f540d34370bb36cf 100644 (file)
         <when-type-assignable class="com.google.gwt.query.client.Selectors"/>\r
     </generate-with>\r
 \r
-\r
-    <generate-with class="com.google.gwt.query.rebind.SelectorGeneratorJS">\r
-        <when-type-assignable class="com.google.gwt.query.client.Selectors"/>\r
-        <any>\r
-            <when-property-is name="user.agent" value="gecko"/>\r
-            <when-property-is name="user.agent" value="ie6"/>\r
-        </any>\r
-    </generate-with>\r
-\r
     <generate-with class="com.google.gwt.query.rebind.SelectorGeneratorCssToXPath">\r
         <when-type-assignable class="com.google.gwt.query.client.Selectors"/>\r
         <any>\r
     <generate-with class="com.google.gwt.query.rebind.SelectorGeneratorNative">\r
         <when-type-assignable class="com.google.gwt.query.client.Selectors"/>\r
         <when-property-is name="selectorCapability" value="native"/>\r
+        <none>\r
+           <when-property-is name="user.agent" value="ie8"/>\r
+        </none>\r
     </generate-with>\r
 \r
-\r
     <replace-with class="com.google.gwt.query.client.impl.DocumentStyleImpl">\r
         <when-type-assignable\r
                 class="com.google.gwt.query.client.impl.DocumentStyleImpl"/>\r
     <replace-with class="com.google.gwt.query.client.impl.DocumentStyleImplIE">\r
         <when-type-assignable\r
                 class="com.google.gwt.query.client.impl.DocumentStyleImpl"/>\r
-        <when-property-is name="user.agent" value="ie6"/>\r
+        <any>\r
+               <when-property-is name="user.agent" value="ie6"/>\r
+               <when-property-is name="user.agent" value="ie8"/>\r
+        </any>\r
     </replace-with>\r
 \r
-\r
     <replace-with class="com.google.gwt.query.client.impl.SelectorEngineSizzle">\r
         <when-type-assignable\r
                 class="com.google.gwt.query.client.impl.SelectorEngineImpl"/>\r
index 40f7557751449e2f1e765288fb3b8b21ce0a0b59..941fd14e9e32ecd4187e10994f933cb97b287796 100644 (file)
@@ -15,7 +15,6 @@
  */\r
 package com.google.gwt.query.client;\r
 \r
-\r
 import static com.google.gwt.query.client.plugins.Effects.Effects;\r
 import static com.google.gwt.query.client.plugins.Events.Events;\r
 \r
@@ -270,44 +269,42 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
   }\r
 \r
   /**\r
-   * Returns the numeric value of a css propery of the element.\r
+   * Returns the numeric value of an element css property\r
    */\r
   public static double cur(Element elem, String prop) {\r
     GQuery g = $(elem);\r
-    if ("height".equals(prop)) {\r
+    String val = g.css(prop, true);\r
+    if ("height".equalsIgnoreCase(prop)) {\r
       return g.clientHeight();\r
     }\r
-    if ("width".equals(prop)) {\r
+    if ("width".equalsIgnoreCase(prop)) {\r
       return g.clientWidth();\r
     }\r
-    if ("absolute".equalsIgnoreCase(g.css("position"))) {\r
-      if ("left".equals(prop)) {\r
+    if ("absolute".equalsIgnoreCase(g.css("position", true))) {\r
+      if ("left".equalsIgnoreCase(prop)) {\r
         return g.offset().left;\r
       }\r
-      if ("top".equals(prop)) {\r
+      if ("top".equalsIgnoreCase(prop)) {\r
         return g.offset().top;\r
       }\r
     }\r
-    if ("opacity".equals(prop)) {\r
-      return Double.parseDouble(g.css("opacity"));\r
+    if ("opacity".equalsIgnoreCase(prop)) {\r
+      return Double.parseDouble(val);\r
     }\r
     if (elem.getPropertyString(prop) != null\r
         && (elem.getStyle() == null || elem.getStyle().getProperty(prop) == null)) {\r
       return elem.getPropertyDouble(prop);\r
     }\r
-    String val = g.css(prop);\r
-    if (val != null) {\r
-      if ("thick".equals(val)) {\r
-        return (5);\r
-      } else if ("medium".equals(val)) {\r
-        return (3);\r
-      } else if ("thin".equals(val)) {\r
-        return (1);\r
-      }\r
-      val = "0" + val.replaceAll("[^\\d\\.]+", "");\r
-      return Double.parseDouble(val);\r
+    \r
+    if ("thick".equalsIgnoreCase(val)) {\r
+      return (5);\r
+    } else if ("medium".equalsIgnoreCase(val)) {\r
+      return (3);\r
+    } else if ("thin".equalsIgnoreCase(val)) {\r
+      return (1);\r
     }\r
-    return 0.0;\r
+    val = "0" + val.replaceAll("[^\\d\\.]+", "");\r
+    return Double.parseDouble(val);\r
   }\r
   \r
   /**\r
@@ -407,10 +404,6 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
     return res;\r
   }\r
 \r
-  private static String curCSS(Element elem, String name) {\r
-    return styleImpl.curCSS(elem, name);\r
-  }\r
-\r
   private static boolean hasClass(Element e, String clz) {\r
     return ((" " + e.getClassName() + " ").matches(".*\\s" + clz + "\\s.*"));\r
   }\r
@@ -798,7 +791,23 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
    * Return a style property on the first matched element.\r
    */\r
   public String css(String name) {\r
-    return curCSS(get(0), name);\r
+    return styleImpl.curCSS(get(0), name, false);\r
+  }\r
+  \r
+  /**\r
+   * Return a style property on the first matched element.\r
+   * \r
+   * The parameter force has a special meaning here:\r
+   * - When force is false, returns the value of the css property defined\r
+   *   in the style attribute of the element. \r
+   * - Otherwise it returns the real computed value.\r
+   * \r
+   * For instance if you define 'display=none' not in the element style\r
+   * but in the css stylesheet, it returns an empty string unless you\r
+   * pass the parameter force=true.   \r
+   */\r
+  public String css(String name, boolean force) {\r
+    return styleImpl.curCSS(get(0), name, force);\r
   }\r
 \r
   /**\r
@@ -806,7 +815,7 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
    */\r
   public GQuery css(String prop, String val) {\r
     for (Element e : elements()) {\r
-      styleImpl.setStyleProperty(prop, val, e);\r
+      styleImpl.setStyleProperty(e, prop, val);\r
     }\r
     return this;\r
   }\r
@@ -1124,7 +1133,7 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
     for (Element e : elements()) {\r
       Object old = data(e, "oldDisplay", null);\r
       if (old == null) {\r
-        data(e, "oldDisplay", styleImpl.curCSS(e, "display"));\r
+        data(e, "oldDisplay", styleImpl.curCSS(e, "display", false));\r
       }\r
       e.getStyle().setDisplay(Display.NONE);\r
     }\r
@@ -1455,7 +1464,7 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
         or(elements.getItem(0).getOffsetParent(), document.getBody());\r
     while (offParent != null && !"body".equalsIgnoreCase(offParent.getTagName())\r
         && !"html".equalsIgnoreCase(offParent.getTagName()) && "static".\r
-        equals(curCSS(offParent, "position"))) {\r
+        equals(styleImpl.curCSS(offParent, "position", true))) {\r
       offParent = offParent.getOffsetParent();\r
     }\r
     return new GQuery(offParent);\r
@@ -1719,10 +1728,10 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
   /**\r
    * Save a set of Css properties of every matched element.\r
    */\r
-  public void restoreCssAttrs(String[] cssProps) {\r
+  public void restoreCssAttrs(String... cssProps) {\r
     for (Element e : elements()) {\r
       for (String a : cssProps) {\r
-        styleImpl.setStyleProperty(a, (String) data(e, "old-" + a, null), e);\r
+        styleImpl.setStyleProperty(e, a, (String) data(e, "old-" + a, null));\r
       }\r
     }\r
   }\r
@@ -1730,10 +1739,10 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
   /**\r
    * Restore a set of previously saved Css properties in every matched element.\r
    */\r
-  public void saveCssAttrs(String[] cssProps) {\r
+  public void saveCssAttrs(String... cssProps) {\r
     for (Element e : elements()) {\r
       for (String a : cssProps) {\r
-        data("old-" + a, curCSS(e, a));\r
+        data("old-" + a, styleImpl.curCSS(e, a, false));\r
       }\r
     }\r
   }\r
@@ -1850,8 +1859,11 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
    */\r
   public GQuery show() {\r
     for (Element e : elements()) {\r
-      Object old = data(e, "oldDisplay", null);\r
-      styleImpl.setStyleProperty("display", old != null? old.toString() : "block", e);\r
+      styleImpl.setStyleProperty(e, "display", SelectorEngine.or((String)data(e, "oldDisplay", null), ""));\r
+      // When the display=none is in the stylesheet.\r
+      if (!styleImpl.isVisible(e)) {\r
+        styleImpl.setStyleProperty(e, "display", "block");\r
+      }\r
     }\r
     return this;\r
   }\r
@@ -2158,7 +2170,7 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
    * Return true if the first element is visible.\r
    */\r
   public boolean visible() {\r
-    return !"none".equalsIgnoreCase(css("display"));\r
+    return styleImpl.isVisible(get(0));\r
   }\r
 \r
   /**\r
index bcb81fd4320324618936475b9433dca65c84162f..95f4e6325b627ea4b2cd72f7d8401b8abd480425 100644 (file)
@@ -16,8 +16,6 @@
 package com.google.gwt.query.client.impl;
 
 import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.Style;
-import com.google.gwt.query.client.SelectorEngine;
 
 /**
  * A helper class to get computed CSS styles for elements.
@@ -25,9 +23,7 @@ import com.google.gwt.query.client.SelectorEngine;
 public class DocumentStyleImpl {
 
   /**
-   * Camelize style property names.
-   *  for instance:
-   *   font-name -> fontName 
+   * Camelize style property names. for instance: font-name -> fontName
    */
   public static native String camelize(String s)/*-{
     return s.replace(/\-(\w)/g, function(all, letter) {
@@ -36,25 +32,30 @@ public class DocumentStyleImpl {
   }-*/;
 
   /**
-   * Hyphenize style property names.
-   *  for instance:
-   *   fontName -> font-name 
+   * Hyphenize style property names. for instance: fontName -> font-name
    */
   public static native String hyphenize(String name) /*-{
     return name.replace(/([A-Z])/g, "-$1" ).toLowerCase();
   }-*/;
 
   /**
-   * Return the string value of a css property of an element. 
+   * Return the string value of a css property of an element.
+   * 
+   * The parameter force has a special meaning here: - When force is false,
+   * returns the value of the css property defined in the style attribute of the
+   * element. - Otherwise it returns the real computed value.
+   * 
+   * For instance if you define 'display=none' not in the element style but in
+   * the css stylesheet, it returns an empty string unless you pass the
+   * parameter force=true.
    */
-  public String curCSS(Element elem, String name) {
+  public String curCSS(Element elem, String name, boolean force) {
     name = fixPropertyName(name);
-    Style s = elem.getStyle();
-    if (SelectorEngine.truth(s.getProperty(name))) {
-      return s.getProperty(name);
+    if (force) {
+      return getComputedStyle(elem, hyphenize(name), name, null);
     } else {
-      name = hyphenize(name);
-      return getComputedStyle(elem, name, null);
+      String ret = elem.getStyle().getProperty(name);
+      return ret == null ? "" : ret;
     }
   }
 
@@ -80,9 +81,9 @@ public class DocumentStyleImpl {
   /**
    * Set the value of a style property of an element.
    */
-  public void setStyleProperty(String prop, String val, Element e) {
+  public void setStyleProperty(Element e, String prop, String val) {
     prop = fixPropertyName(prop);
-    // put it in lower-case only when all letters are upper-case, to avoid 
+    // put it in lower-case only when all letters are upper-case, to avoid
     // modifying already camelized properties
     if (prop.matches("^[A-Z]+$")) {
       prop = prop.toLowerCase();
@@ -94,11 +95,18 @@ public class DocumentStyleImpl {
       e.getStyle().setProperty(prop, val);
     }
   }
+  
+  /**
+   * Return whether the element is visible
+   */
+  public boolean isVisible(Element e) {
+    return !"none".equalsIgnoreCase(curCSS(e, "display", true));
+  }
 
-  protected native String getComputedStyle(Element elem, String name,
-      String pseudo) /*-{
-    var cStyle = $doc.defaultView.getComputedStyle( elem, pseudo );
-    return cStyle ? cStyle.getPropertyValue( name ) : null;
+  protected native String getComputedStyle(Element elem, String hyphenName,
+      String camelName, String pseudo) /*-{
+    var cStyle = $doc.defaultView.getComputedStyle(elem, pseudo);
+    return cStyle ? cStyle.getPropertyValue(hyphenName) : null;
   }-*/;
 
 }
index e3148bc9c0007f2c991192a5f125e82c3fb1bf9d..0b7b45e7bd9b8f8823adad0a74b261848d232c2d 100644 (file)
@@ -26,9 +26,18 @@ public class DocumentStyleImplIE extends DocumentStyleImpl {
   /**
    * Return the string value of a css property of an element. 
    * IE needs a special workaround to handle opacity.
+   * 
+   * The parameter force has a special meaning here:
+   * - When force is false, returns the value of the css property defined
+   *   in the style attribute of the element. 
+   * - Otherwise it returns the real computed value.
+   * 
+   * For instance if you define 'display=none' not in the element style
+   * but in the css stylesheet, it returns an empty string unless you
+   * pass the parameter force=true.   
    */
   @Override
-  public String curCSS(Element elem, String name) {
+  public String curCSS(Element elem, String name, boolean force) {
     if ("opacity".equalsIgnoreCase(name)) {
       Style s = elem.getStyle();
       String o = s.getProperty("filter");
@@ -39,7 +48,7 @@ public class DocumentStyleImplIE extends DocumentStyleImpl {
       o = s.getProperty("opacity");
       return o == null || o.length() == 0 ? "1" : o;
     }
-    return super.curCSS(elem, name);
+    return super.curCSS(elem, name, force);
   }
 
   /**
@@ -68,25 +77,22 @@ public class DocumentStyleImplIE extends DocumentStyleImpl {
    * IE needs a special workaround to handle opacity
    */
   @Override
-  public void setStyleProperty(String prop, String val, Element e) {
+  public void setStyleProperty(Element e, String prop, String val) {
     if ("opacity".equals(prop)) {
       e.getStyle().setProperty("zoom", "1");
       e.getStyle().setProperty("filter",
           "alpha(opacity=" + (int) (Double.valueOf(val) * 100) + ")");
     } else {
-      super.setStyleProperty(prop, val, e);
+      super.setStyleProperty(e, prop, val);
     }
   }
 
   @Override
-  protected native String getComputedStyle(Element elem, String name,
-      String pseudo) /*-{
+  protected native String getComputedStyle(Element elem, String hyphenName,
+      String camelName, String pseudo) /*-{
     // code lifted from jQuery
     var style = elem.style;
-    var camelCase = name.replace(/\-(\w)/g, function(all, letter){
-        return letter.toUpperCase();
-    });
-    var ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
+    var ret = elem.currentStyle[hyphenName] || elem.currentStyle[camelName];
     // From the awesome hack by Dean Edwards
     // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
     // If we're not dealing with a regular pixel number
index 08e048ad78413b0c8c5cbf488a3ae9821e4b80d8..b10c9cb46c7ee67c6a9fb413a30b13d12a9289a1 100755 (executable)
@@ -20,6 +20,7 @@ import java.util.ArrayList;
 import com.google.gwt.animation.client.Animation;\r
 import com.google.gwt.dom.client.Element;\r
 import com.google.gwt.query.client.Function;\r
+import com.google.gwt.query.client.GQuery;\r
 import com.google.gwt.query.client.JSArray;\r
 import com.google.gwt.query.client.Properties;\r
 import com.google.gwt.query.client.Regexp;\r
@@ -42,16 +43,14 @@ public class PropertiesAnimation extends Animation {
 \r
     public String attr;\r
     public double end;\r
-    public String old;\r
     public double start;\r
     public String unit;\r
     public String value;\r
 \r
-    Effect(String attr, String value, String old, double start, double end,\r
+    Effect(String attr, String value, double start, double end,\r
         String unit) {\r
       this.attr = attr;\r
       this.value = value;\r
-      this.old = old;\r
       this.start = start;\r
       this.end = end;\r
       this.unit = nonPx.test(attr) ? "" : unit == null ? "px" : unit;\r
@@ -64,7 +63,7 @@ public class PropertiesAnimation extends Animation {
   }\r
 \r
   private static final String[] attrsToSave = new String[] { "overflow",\r
-      "visivility", "white-space" };\r
+      "visibility", "white-space" };\r
   private Element e;\r
   private Easing easing = Easing.SWING;\r
   private ArrayList<Effect> effects = new ArrayList<Effect>();\r
@@ -90,16 +89,16 @@ public class PropertiesAnimation extends Animation {
   @Override\r
   public void onComplete() {\r
     super.onComplete();\r
-    g.restoreCssAttrs(attrsToSave);\r
     for (Effect l : effects) {\r
       if ("hide".equals(l.value)) {\r
         g.hide();\r
-        g.css(l.attr, l.old);\r
+        g.restoreCssAttrs(l.attr);\r
       } else if ("show".equals(l.value)) {\r
         g.show();\r
-        g.css(l.attr, l.old);\r
+        g.restoreCssAttrs(l.attr);\r
       }\r
     }\r
+    g.restoreCssAttrs(attrsToSave);\r
     g.each(funcs);\r
     g.dequeue();\r
   }\r
@@ -107,6 +106,7 @@ public class PropertiesAnimation extends Animation {
   @Override\r
   public void onStart() {\r
     boolean hidden = !g.visible();\r
+    boolean resize = false;\r
     g.show();\r
     for (String key : prps.keys()) {\r
       String val = prps.get(key);\r
@@ -114,13 +114,13 @@ public class PropertiesAnimation extends Animation {
         val = hidden ? "show" : "hide";\r
       }\r
       if (("top".equals(key) || "left".equals(key))\r
-          && !"absolute".equalsIgnoreCase(g.css("position"))) {\r
+          && !"absolute".equalsIgnoreCase(g.css("position", true))) {\r
         g.css("position", "relative");\r
       }\r
 \r
       JSArray parts = new Regexp("^([+-]=)?([0-9+-.]+)(.*)?$").match(val);\r
       String unit = parts != null ? parts.getStr(3) : "";\r
-      double start = Effects.cur(e, key);\r
+      double start = GQuery.cur(e, key);\r
       double end = start;\r
       if (parts != null) {\r
         end = Double.parseDouble(parts.getStr(2));\r
@@ -131,18 +131,23 @@ public class PropertiesAnimation extends Animation {
         if (!hidden) {\r
           return;\r
         }\r
+        g.saveCssAttrs(key);\r
         start = 0;\r
       } else if ("hide".equals(val)) {\r
         if (hidden) {\r
           return;\r
         }\r
+        g.saveCssAttrs(key);\r
         end = 0;\r
       }\r
-      effects.add(new Effect(key, val, g.css(key), start, end, unit));\r
+      resize = resize || "height".equals(key) || "width".equals(key);\r
+      effects.add(new Effect(key, val, start, end, unit));\r
     }\r
     g.saveCssAttrs(attrsToSave);\r
-    g.css("overflow", "hidden");\r
-    g.css("visivility", "visible");\r
+    if (resize) {\r
+      g.css("overflow", "hidden");\r
+    }\r
+    g.css("visibility", "visible");\r
     g.css("white-space", "nowrap");\r
     super.onStart();\r
   }\r
index c133128aa8ffe008482c1c24a2774bed4f78a9d4..c1d240b6c8938fb32ee6d50c9d5a56f82e741d61 100644 (file)
@@ -607,10 +607,10 @@ public class GQueryCoreTest extends GWTTestCase {
     sectA.show();
     assertEquals("inline", sectA.css("display"));
     sectB.show();
-    assertEquals("block", sectB.css("display"));
+    assertEquals("", sectB.css("display"));
     
     // toggle()
-    assertEquals("block", sectC.css("display"));
+    assertEquals("", sectC.css("display"));
     sectC.toggle();
     assertEquals("none", sectC.css("display"));
     sectC.toggle();
index 3e095f1b781222b5082d1b9e6837a32dba5158c2..94e2bd115310a27e6fc76e7ce8babd73b93a912f 100644 (file)
@@ -84,7 +84,7 @@ public class GQueryEffectsTest extends GWTTestCase {
     Timer timerMidTime = new Timer() {
       public void run() {
         assertEquals("inline", sectA.css("display"));
-        assertEquals("block", sectB.css("display"));
+        assertEquals("", sectB.css("display"));
         double o = Double.valueOf(sectA.css("opacity"));
         assertTrue(
             "'sectA' opacity must be in the interval 0.5-1 but is: " + o,
index cbaca98de41d9c6faee657cabdb522fe66032af1..0e1b5ebc56c5ead95a30aa6896830d6dc254d8c0 100644 (file)
@@ -66,6 +66,7 @@
                   <fileset><directory>src/main/webapp/gwtquery.samples.GwtQueryPlugin</directory></fileset>
                   <fileset><directory>src/main/webapp/gwtquery.samples.GwtQuerySample</directory></fileset>
                   <fileset><directory>src/main/webapp/gwtquery.samples.GwtQueryWidgets</directory></fileset>
+                  <fileset><directory>src/main/webapp/test</directory></fileset>
                   <fileset><directory>src/main/webapp/WEB-INF/classes</directory></fileset>
                   <fileset><directory>tomcat</directory></fileset>
                   <fileset><directory>www-test</directory></fileset>
index ca695fdb862ecdbfd5445cce503221dee9691bcd..80ac00df37a609a5f5b0a36f3851f891b987c117 100644 (file)
@@ -33,13 +33,19 @@ public class GwtQueryEffectsModule implements EntryPoint {
     \r
     final Effects a = $(".a, .b > div:nth-child(2)").as(Effects.Effects);\r
     \r
-    $("#b1").toggle(new Function() {\r
+    $("#b0").width(150).css("font-size", "10px").toggle(new Function() {\r
       public void f(Element e) {\r
-        $("#i1").as(Effects.Effects).animate(" width: '70%', opacity: '0.4', marginLeft: '0.6in', fontSize: '3em', borderWidth: '10px'");\r
+        $("#b0").as(Effects.Effects).animate(" width: '400', opacity: '0.4', marginLeft: '0.6in', fontSize: '24px'");\r
       }\r
     }, new Function() {\r
       public void f(Element e) {\r
-        $("#i1").as(Effects.Effects).animate(" width: '0%', opacity: '1', marginLeft: '0', fontSize: '1em', borderWidth: '5px'");\r
+        $("#b0").as(Effects.Effects).animate(" width: '150', opacity: '1', marginLeft: '0', fontSize: '10px'");\r
+      }\r
+    });\r
+    \r
+    $("#b1").toggle(new Function() {\r
+      public void f(Element e) {\r
+        $(".a").toggle();\r
       }\r
     }, new Function() {\r
       public void f(Element e) {\r
@@ -67,15 +73,19 @@ public class GwtQueryEffectsModule implements EntryPoint {
       }\r
     }, new Function() {\r
       public void f(Element e) {\r
-        a.animate("left: '+=25%', width: 'hide'");\r
+        a.animate("left: '+=300', width: 'hide'");\r
       }\r
     }, new Function() {\r
       public void f(Element e) {\r
-        a.animate("left: '-=25%', width: 'show'");\r
+        a.animate("left: '-=300', width: 'show'");\r
       }\r
     });\r
     \r
     $("#b2").toggle(new Function() {\r
+      public void f(Element e) {\r
+        $(".a").toggle();\r
+      }\r
+    }, new Function() {\r
       public void f(Element e) {\r
         a.as(Effects.Effects).clipUp();\r
       }\r
index caaac70b6985e2d4d334606048cd4335078fd937..1f041bb65971a4817201f756d617d9f1a370a3ff 100644 (file)
@@ -1,3 +1,5 @@
+<!doctype html>\r
+\r
 <html>\r
 <head>\r
     <title>GQuery</title>\r
index 90b79b2875fbc4fe81135812549b71f554e05851..766a300112b1a8af7ef370c02e87adb8c2991626 100644 (file)
@@ -1,3 +1,5 @@
+<!--<!doctype html>-->\r
+\r
 <html>\r
 <head>\r
     <title>GQuery Demo</title>\r
@@ -16,6 +18,7 @@
           background: pink;\r
           width: 50%;\r
           padding: 10px;\r
+          display: none;\r
        }\r
        </style>\r
 </head>\r
@@ -31,6 +34,7 @@
     <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>\r
 </div>\r
 <br/>\r
+<button id="b0">Animate me</button><br/>\r
 <button id="b1">Toggle Animate effects</button>\r
 <button id="b2">Toggle Clip effects</button>\r
 <br/>\r