diff options
36 files changed, 543 insertions, 429 deletions
diff --git a/devtest/pom.xml b/devtest/pom.xml index cd6ec0de..7c4e5e9c 100644 --- a/devtest/pom.xml +++ b/devtest/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <groupId>com.google.gwt</groupId> + <groupId>com.googlecode.gwtquery</groupId> <artifactId>gwtquery-project</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> diff --git a/gwtquery-core/pom.xml b/gwtquery-core/pom.xml index c8852bcb..6fc760c0 100644 --- a/gwtquery-core/pom.xml +++ b/gwtquery-core/pom.xml @@ -53,19 +53,6 @@ <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <executions> - <execution> - <id>attach-javadocs</id> - <phase>verify</phase> - <goals> - <goal>jar</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skipTests>false</skipTests> diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/QueryMin.gwt.xml b/gwtquery-core/src/main/java/com/google/gwt/query/QueryMin.gwt.xml new file mode 100644 index 00000000..a1381bd8 --- /dev/null +++ b/gwtquery-core/src/main/java/com/google/gwt/query/QueryMin.gwt.xml @@ -0,0 +1,44 @@ +<module>
+ <!--
+ Include com.google.gwt.query.QueryMin instead of com.google.gwt.query.Query
+ if you want small javascript code and you are not using any of the selectors:
+ ".*(:contains|!=|:checked|:not|:nth-|:last-|:only-).*"
+
+ Note: that this will increase the number of total permutations.
+ -->
+ <inherits name='com.google.gwt.query.Query'/>
+
+ <define-property name="selectorCapability" values="native,js"/>
+ <property-provider name="selectorCapability">
+ <![CDATA[
+ return document.location.href.indexOf("_force_no_native") < 0 &&
+ document.querySelectorAll &&
+ /native/.test(String(document.querySelectorAll)) ? "native" : "js";
+ ]]>
+ </property-provider>
+
+ <!-- Selector Engines -->
+ <replace-with class="com.google.gwt.query.client.impl.SelectorEngineNativeMin">
+ <when-type-assignable class="com.google.gwt.query.client.impl.SelectorEngineImpl"/>
+ <any>
+ <when-property-is name="user.agent" value="gecko1_8"/>
+ <when-property-is name="user.agent" value="opera"/>
+ <when-property-is name="user.agent" value="safari"/>
+ </any>
+ <when-property-is name="selectorCapability" value="native"/>
+ </replace-with>
+ <replace-with class="com.google.gwt.query.client.impl.SelectorEngineCssToXPath">
+ <when-type-assignable class="com.google.gwt.query.client.impl.SelectorEngineImpl"/>
+ <any>
+ <when-property-is name="user.agent" value="gecko1_8"/>
+ <when-property-is name="user.agent" value="opera"/>
+ <when-property-is name="user.agent" value="safari"/>
+ </any>
+ <when-property-is name="selectorCapability" value="js"/>
+ </replace-with>
+ <replace-with class="com.google.gwt.query.client.impl.SelectorEngineNativeMinIE8">
+ <when-type-assignable class="com.google.gwt.query.client.impl.SelectorEngineImpl"/>
+ <when-property-is name="user.agent" value="ie8"/>
+ <when-property-is name="selectorCapability" value="native"/>
+ </replace-with>
+</module>
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java index 00df5dda..ff201feb 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java @@ -47,7 +47,7 @@ public abstract class Function { if (w != null){ return f(w, i); } else { - f(e); + f((com.google.gwt.user.client.Element)e); return ""; } } @@ -73,7 +73,7 @@ public abstract class Function { * Override this method for bound event handlers. */ public boolean f(Event e) { - f((Element)e.getCurrentEventTarget().cast()); + f((com.google.gwt.user.client.Element)e.getCurrentEventTarget().cast()); return true; } @@ -90,6 +90,11 @@ public abstract class Function { } } + + public void f(com.google.gwt.user.client.Element e) { + f((Element)e); + } + /** * Override this for GQuery methods which take a callback, but do not expect a * return value, apply to a single widget. @@ -102,4 +107,5 @@ public abstract class Function { public void f(Widget w){ f(); } + } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java index 8a88cd81..b9f04f3f 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java @@ -19,6 +19,11 @@ import static com.google.gwt.query.client.plugins.Effects.Effects; import static com.google.gwt.query.client.plugins.Events.Events;
import static com.google.gwt.query.client.plugins.Widgets.Widgets;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
@@ -33,8 +38,8 @@ import com.google.gwt.dom.client.Node; import com.google.gwt.dom.client.NodeList;
import com.google.gwt.dom.client.OptionElement;
import com.google.gwt.dom.client.SelectElement;
-import com.google.gwt.dom.client.TextAreaElement;
import com.google.gwt.dom.client.Style.Display;
+import com.google.gwt.dom.client.TextAreaElement;
import com.google.gwt.query.client.css.CssProperty;
import com.google.gwt.query.client.css.Length;
import com.google.gwt.query.client.css.Percentage;
@@ -48,11 +53,6 @@ import com.google.gwt.user.client.EventListener; import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Widget;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-
/**
* Gwt Query is a GWT clone of the popular jQuery library.
*/
@@ -224,6 +224,22 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> { public static GQuery $(NodeList<Element> elements) {
return new GQuery(elements);
}
+
+ /**
+ * Create a new GQuery given a list of objects.
+ * Only node objects will be added;
+ */
+ public static GQuery $(@SuppressWarnings("rawtypes") ArrayList a) {
+ JSArray elements = JSArray.create();
+ for (Object o : a ) {
+ if (o instanceof Node) {
+ elements.addNode((Node)o);
+ } else if (o instanceof Widget) {
+ elements.addNode(((Widget)o).getElement());
+ }
+ }
+ return new GQuery(elements);
+ }
/**
* This function accepts a string containing a CSS selector which is then used
@@ -1168,6 +1184,13 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> { }
return pushStack(unique(array), "find", filters[0]);
}
+
+ /**
+ * Reduce the set of matched elements to the first in the set.
+ */
+ public GQuery first() {
+ return eq(0);
+ }
/**
* Bind a set of functions to the focus event of each matched element.
@@ -1431,6 +1454,13 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> { public GQuery keyup(int key) {
return trigger(Event.ONKEYUP, key);
}
+
+ /**
+ * Reduce the set of matched elements to the final one in the set.
+ */
+ public GQuery last() {
+ return eq(size() - 1);
+ }
/**
* Returns the computed left position of the first element matched.
@@ -1464,6 +1494,23 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> { }
/**
+ * Pass each element in the current matched set through a function,
+ * producing a new array containing the return values.
+ */
+ @SuppressWarnings("unchecked")
+ public <W> ArrayList<W> map(Function f) {
+ @SuppressWarnings("rawtypes")
+ ArrayList ret = new ArrayList();
+ for (int i = 0; i < elements().length; i++) {
+ Object o = f.f(elements()[i], i);
+ if (o != null) {
+ ret.add(o);
+ }
+ }
+ return ret;
+ }
+
+ /**
* Bind a set of functions to the mousedown event of each matched element.
* Or trigger the event if no functions are provided.
*/
@@ -2440,9 +2487,10 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> { * Return the first non null attached widget from the matched elements
* or null if there isn't any.
*/
- public Widget widget(){
+ public <W extends Widget> W widget(){
for (Element e : elements()){
- Widget w = getAssociatedWidget(e);
+ @SuppressWarnings("unchecked")
+ W w = (W) getAssociatedWidget(e);
if (w != null){
return w;
}
@@ -2631,7 +2679,6 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> { g.setSelector(selector);
return g;
}
-
private void allNextSiblingElements(Element firstChildElement, JSArray result,
Element elem) {
@@ -2713,7 +2760,6 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> { return this;
}
-
private native Element getPreviousSiblingElement(Element elem) /*-{
var sib = elem.previousSibling;
while (sib && sib.nodeType != 1)
@@ -2729,10 +2775,6 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> { return res;
}
-
-
-
-
private void removeData(Element item, String name) {
if (dataCache == null) {
windowData = JavaScriptObject.createObject().cast();
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java index 4ce4ae90..39b49a71 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java @@ -17,6 +17,10 @@ package com.google.gwt.query.client; import static com.google.gwt.query.client.plugins.Effects.Effects; import static com.google.gwt.query.client.plugins.Events.Events; import static com.google.gwt.query.client.plugins.Widgets.Widgets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.core.client.JsArray; @@ -31,8 +35,8 @@ import com.google.gwt.dom.client.Node; import com.google.gwt.dom.client.NodeList; import com.google.gwt.dom.client.OptionElement; import com.google.gwt.dom.client.SelectElement; -import com.google.gwt.dom.client.TextAreaElement; import com.google.gwt.dom.client.Style.Display; +import com.google.gwt.dom.client.TextAreaElement; import com.google.gwt.query.client.css.CssProperty; import com.google.gwt.query.client.css.Length; import com.google.gwt.query.client.css.Percentage; @@ -45,10 +49,6 @@ import com.google.gwt.user.client.Event; import com.google.gwt.user.client.EventListener; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.Widget; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; import com.google.gwt.query.client.LazyBase; public interface LazyGQuery<T> extends LazyBase<T>{ @@ -441,6 +441,11 @@ public interface LazyGQuery<T> extends LazyBase<T>{ LazyGQuery<T> find(String... filters); /** + * Reduce the set of matched elements to the first in the set. + */ + LazyGQuery<T> first(); + + /** * Bind a set of functions to the focus event of each matched element. * Or trigger the event if no functions are provided. */ @@ -614,6 +619,11 @@ public interface LazyGQuery<T> extends LazyBase<T>{ LazyGQuery<T> keyup(int key); /** + * Reduce the set of matched elements to the final one in the set. + */ + LazyGQuery<T> last(); + + /** * Returns the computed left position of the first element matched. */ int left(); @@ -637,6 +647,12 @@ public interface LazyGQuery<T> extends LazyBase<T>{ LazyGQuery<T> lt(int pos); /** + * Pass each element in the current matched set through a function, + * producing a new array containing the return values. + */ + <W> ArrayList<W> map(Function f); + + /** * Bind a set of functions to the mousedown event of each matched element. * Or trigger the event if no functions are provided. */ @@ -1129,7 +1145,7 @@ public interface LazyGQuery<T> extends LazyBase<T>{ * Return the first non null attached widget from the matched elements * or null if there isn't any. */ - Widget widget(); + <W extends Widget> W widget(); /** * return the list of attached widgets matching the query diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineImpl.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineImpl.java index 7e1f8ad8..6d6c64f1 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineImpl.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineImpl.java @@ -26,100 +26,5 @@ import com.google.gwt.query.client.Regexp; */
public abstract class SelectorEngineImpl implements HasSelector {
- /**
- * Internal class.
- */
- protected static class Sequence {
-
- public int start;
-
- public int max;
-
- public int add;
-
- public int modVal;
- }
-
- /**
- * Internal class.
- */
- protected static class SplitRule {
-
- public String tag;
-
- public String id;
-
- public String allClasses;
-
- public String allAttr;
-
- public String allPseudos;
-
- public String tagRelation;
-
- public SplitRule(String tag, String id, String allClasses, String allAttr,
- String allPseudos) {
- this.tag = tag;
- this.id = id;
- this.allClasses = allClasses;
- this.allAttr = allAttr;
- this.allPseudos = allPseudos;
- }
-
- public SplitRule(String tag, String id, String allClasses, String allAttr,
- String allPseudos, String tagRelation) {
- this.tag = tag;
- this.id = id;
- this.allClasses = allClasses;
- this.allAttr = allAttr;
- this.allPseudos = allPseudos;
- this.tagRelation = tagRelation;
- }
- }
-
- protected static Sequence getSequence(String expression) {
- int start = 0, add = 2, max = -1, modVal = -1;
- Regexp expressionRegExp = new Regexp(
- "^((odd|even)|([1-9]\\d*)|((([1-9]\\d*)?)n((\\+|\\-)(\\d+))?)|(\\-(([1-9]\\d*)?)n\\+(\\d+)))$");
- JSArray pseudoValue = expressionRegExp.exec(expression);
- if (!truth(pseudoValue)) {
- return null;
- } else {
- if (truth(pseudoValue.getStr(2))) { // odd or even
- start = (eq(pseudoValue.getStr(2), "odd")) ? 1 : 2;
- modVal = (start == 1) ? 1 : 0;
- } else if (GQUtils
- .truth(pseudoValue.getStr(3))) { // single digit
- start = Integer.parseInt(pseudoValue.getStr(3), 10);
- add = 0;
- max = start;
- } else if (truth(pseudoValue.getStr(4))) { // an+b
- add = truth(pseudoValue.getStr(6)) ? Integer
- .parseInt(pseudoValue.getStr(6), 10) : 1;
- start = truth(pseudoValue.getStr(7)) ? Integer.parseInt(
- (pseudoValue.getStr(8).charAt(0) == '+' ? ""
- : pseudoValue.getStr(8)) + pseudoValue.getStr(9), 10) : 0;
- while (start < 1) {
- start += add;
- }
- modVal = (start > add) ? (start - add) % add
- : ((start == add) ? 0 : start);
- } else if (truth(pseudoValue.getStr(10))) { // -an+b
- add = truth(pseudoValue.getStr(12)) ? Integer
- .parseInt(pseudoValue.getStr(12), 10) : 1;
- start = max = Integer.parseInt(pseudoValue.getStr(13), 10);
- while (start > add) {
- start -= add;
- }
- modVal = (max > add) ? (max - add) % add : ((max == add) ? 0 : max);
- }
- }
- Sequence s = new Sequence();
- s.start = start;
- s.add = add;
- s.max = max;
- s.modVal = modVal;
- return s;
- }
}
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeIE8.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeIE8.java index c880a3ec..1383f8de 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeIE8.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeIE8.java @@ -21,8 +21,12 @@ import com.google.gwt.dom.client.NodeList; import com.google.gwt.query.client.SelectorEngine; /** - * Runtime selector engine implementation for browsers with native - * querySelectorAll support. + * Runtime selector engine implementation for IE with native + * querySelectorAll support (IE8 standards mode). + * + * It will fall back to Sizzle engine when QuerySelector were unavailable + * or in the case of selectors unsupported by the IE8 native QuerySelector. + * */ public class SelectorEngineNativeIE8 extends SelectorEngineSizzleIE { diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeMin.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeMin.java new file mode 100644 index 00000000..98fc77ed --- /dev/null +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeMin.java @@ -0,0 +1,42 @@ +/* + * Copyright 2009 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.query.client.impl; + +import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.Node; +import com.google.gwt.dom.client.NodeList; +import com.google.gwt.query.client.SelectorEngine; +import com.google.gwt.user.client.Window; + +/** + * Runtime selector engine implementation for browsers with native + * querySelectorAll support. + * + * In the case of unsupported selectors, it will display an error message + * instead of falling back to a pure js implementation. + */ +public class SelectorEngineNativeMin extends SelectorEngineImpl { + + public NodeList<Element> select(String selector, Node ctx) { + try { + return SelectorEngine.querySelectorAllImpl(selector, ctx); + } catch (Exception e) { + Window.alert("Selector '" + selector + "' is unsupported in this Native engine, do not use this syntax or configure your module to use JS fallback"); + return null; + } + } + +} diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeMinIE8.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeMinIE8.java new file mode 100644 index 00000000..4d98d912 --- /dev/null +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineNativeMinIE8.java @@ -0,0 +1,42 @@ +/* + * Copyright 2009 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.query.client.impl; + +import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.Node; +import com.google.gwt.dom.client.NodeList; +import com.google.gwt.query.client.SelectorEngine; +import com.google.gwt.user.client.Window; + +/** + * Runtime selector engine implementation for IE with native querySelectorAll + * support (IE8 standards mode). + * + * In the case of QuerySelector were unavailable or unsupported selectors, it + * will display an error message instead of falling back to js. + */ +public class SelectorEngineNativeMinIE8 extends SelectorEngineImpl { + + public NodeList<Element> select(String selector, Node ctx) { + try { + return SelectorEngine.querySelectorAllImpl(selector, ctx); + } catch (Exception e) { + Window.alert("Selector '" + selector + "' is unsupported in this IE8 engine, check that you are in 'standards mode' or configure your module to use JS fallback"); + return null; + } + } + +} diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineJS.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/research/SelectorEngineJS.java index 5f7446b8..ad722e55 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineJS.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/research/SelectorEngineJS.java @@ -13,7 +13,10 @@ * License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.query.client.impl;
+package com.google.gwt.query.client.impl.research;
+
+import static com.google.gwt.query.client.GQUtils.eq;
+import static com.google.gwt.query.client.GQUtils.truth;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
@@ -25,12 +28,110 @@ import com.google.gwt.query.client.GQUtils; import com.google.gwt.query.client.JSArray;
import com.google.gwt.query.client.Regexp;
import com.google.gwt.query.client.SelectorEngine;
+import com.google.gwt.query.client.impl.SelectorEngineImpl;
/**
* Runtime selector engine implementation with no-XPath/native support based on
* DOMAssistant.
*/
public class SelectorEngineJS extends SelectorEngineImpl {
+
+
+ /**
+ * Internal class.
+ */
+ protected static class Sequence {
+
+ public int start;
+
+ public int max;
+
+ public int add;
+
+ public int modVal;
+ }
+
+ /**
+ * Internal class.
+ */
+ protected static class SplitRule {
+
+ public String tag;
+
+ public String id;
+
+ public String allClasses;
+
+ public String allAttr;
+
+ public String allPseudos;
+
+ public String tagRelation;
+
+ public SplitRule(String tag, String id, String allClasses, String allAttr,
+ String allPseudos) {
+ this.tag = tag;
+ this.id = id;
+ this.allClasses = allClasses;
+ this.allAttr = allAttr;
+ this.allPseudos = allPseudos;
+ }
+
+ public SplitRule(String tag, String id, String allClasses, String allAttr,
+ String allPseudos, String tagRelation) {
+ this.tag = tag;
+ this.id = id;
+ this.allClasses = allClasses;
+ this.allAttr = allAttr;
+ this.allPseudos = allPseudos;
+ this.tagRelation = tagRelation;
+ }
+ }
+
+ protected static Sequence getSequence(String expression) {
+ int start = 0, add = 2, max = -1, modVal = -1;
+ Regexp expressionRegExp = new Regexp(
+ "^((odd|even)|([1-9]\\d*)|((([1-9]\\d*)?)n((\\+|\\-)(\\d+))?)|(\\-(([1-9]\\d*)?)n\\+(\\d+)))$");
+ JSArray pseudoValue = expressionRegExp.exec(expression);
+ if (!truth(pseudoValue)) {
+ return null;
+ } else {
+ if (truth(pseudoValue.getStr(2))) { // odd or even
+ start = (eq(pseudoValue.getStr(2), "odd")) ? 1 : 2;
+ modVal = (start == 1) ? 1 : 0;
+ } else if (GQUtils
+ .truth(pseudoValue.getStr(3))) { // single digit
+ start = Integer.parseInt(pseudoValue.getStr(3), 10);
+ add = 0;
+ max = start;
+ } else if (truth(pseudoValue.getStr(4))) { // an+b
+ add = truth(pseudoValue.getStr(6)) ? Integer
+ .parseInt(pseudoValue.getStr(6), 10) : 1;
+ start = truth(pseudoValue.getStr(7)) ? Integer.parseInt(
+ (pseudoValue.getStr(8).charAt(0) == '+' ? ""
+ : pseudoValue.getStr(8)) + pseudoValue.getStr(9), 10) : 0;
+ while (start < 1) {
+ start += add;
+ }
+ modVal = (start > add) ? (start - add) % add
+ : ((start == add) ? 0 : start);
+ } else if (truth(pseudoValue.getStr(10))) { // -an+b
+ add = truth(pseudoValue.getStr(12)) ? Integer
+ .parseInt(pseudoValue.getStr(12), 10) : 1;
+ start = max = Integer.parseInt(pseudoValue.getStr(13), 10);
+ while (start > add) {
+ start -= add;
+ }
+ modVal = (max > add) ? (max - add) % add : ((max == add) ? 0 : max);
+ }
+ }
+ Sequence s = new Sequence();
+ s.start = start;
+ s.add = add;
+ s.max = max;
+ s.modVal = modVal;
+ return s;
+ }
public static void clearAdded(JSArray a) {
for (int i = 0, len = a.size(); i < len; i++) {
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineJSIE.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/research/SelectorEngineJSIE.java index be93619b..7d34a908 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineJSIE.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/research/SelectorEngineJSIE.java @@ -1,4 +1,4 @@ -package com.google.gwt.query.client.impl;
+package com.google.gwt.query.client.impl.research;
import com.google.gwt.dom.client.Element;
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineSizzleGwt.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/research/SelectorEngineSizzleGwt.java index 44780ea9..7a6e58b0 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineSizzleGwt.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/research/SelectorEngineSizzleGwt.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.google.gwt.query.client.impl; +package com.google.gwt.query.client.impl.research; import com.google.gwt.core.client.JavaScriptObject; @@ -22,6 +22,7 @@ import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Node; import com.google.gwt.dom.client.NodeList; import com.google.gwt.query.client.GQUtils; +import com.google.gwt.query.client.impl.SelectorEngineImpl; /** * Pure Javascript Selector Engine Gwt Implementation based on @@ -84,7 +85,7 @@ public class SelectorEngineSizzleGwt extends SelectorEngineImpl { } } if ( isPartStrNotTag ) { - @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::filter(Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;ZLjava/lang/Object;)( part, checkSet, true ); + @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::filter(Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;ZLjava/lang/Object;)( part, checkSet, true ); } }, ">": function(checkSet, part){ @@ -109,7 +110,7 @@ public class SelectorEngineSizzleGwt extends SelectorEngineImpl { } } if ( isPartStr ) { - @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::filter(Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;ZLjava/lang/Object;)( part, checkSet, true ); + @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::filter(Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;ZLjava/lang/Object;)( part, checkSet, true ); } } }, @@ -117,17 +118,17 @@ public class SelectorEngineSizzleGwt extends SelectorEngineImpl { var doneName = done++; if ( typeof part === "string" && !/\W/.test(part) ) { checkFn = $wnd.dirNodeCheck; - @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::dirNodeCheck(Ljava/lang/String;Ljava/lang/Object;ILjava/lang/Object;)("parentNode", part, doneName, checkSet); + @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::dirNodeCheck(Ljava/lang/String;Ljava/lang/Object;ILjava/lang/Object;)("parentNode", part, doneName, checkSet); } else { - @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::dirCheck(Ljava/lang/String;Ljava/lang/Object;ILjava/lang/Object;)("parentNode", part, doneName, checkSet); + @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::dirCheck(Ljava/lang/String;Ljava/lang/Object;ILjava/lang/Object;)("parentNode", part, doneName, checkSet); } }, "~": function(checkSet, part){ var doneName = done++; if ( typeof part === "string" && !/\W/.test(part) ) { - @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::dirNodeCheck(Ljava/lang/String;Ljava/lang/Object;ILjava/lang/Object;)("previousSibling", part, doneName, checkSet); + @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::dirNodeCheck(Ljava/lang/String;Ljava/lang/Object;ILjava/lang/Object;)("previousSibling", part, doneName, checkSet); } else { - @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::dirCheck(Ljava/lang/String;Ljava/lang/Object;ILjava/lang/Object;)("previousSibling", part, doneName, checkSet); + @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::dirCheck(Ljava/lang/String;Ljava/lang/Object;ILjava/lang/Object;)("previousSibling", part, doneName, checkSet); } } }, @@ -204,9 +205,9 @@ public class SelectorEngineSizzleGwt extends SelectorEngineImpl { if ( match[1] === "not" ) { // If we're dealing with a complex expression, or a simple one if ( ( $wnd.Expr.match.CHUNKER.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::select(Ljava/lang/String;Lcom/google/gwt/dom/client/Node;Lcom/google/gwt/core/client/JsArray;Lcom/google/gwt/core/client/JsArray;)(match[3], null, null, curLoop); + match[3] = @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::select(Ljava/lang/String;Lcom/google/gwt/dom/client/Node;Lcom/google/gwt/core/client/JsArray;Lcom/google/gwt/core/client/JsArray;)(match[3], null, null, curLoop); } else { - var ret = @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::filter(Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;ZLjava/lang/Object;)(match[3], curLoop, inplace, true ^ not); + var ret = @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::filter(Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;ZLjava/lang/Object;)(match[3], curLoop, inplace, true ^ not); if ( !inplace ) { result.push.apply( result, ret ); } @@ -245,7 +246,7 @@ public class SelectorEngineSizzleGwt extends SelectorEngineImpl { return !elem.firstChild; }, has: function(elem, i, match){ - return !!@com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::select(Ljava/lang/String;Lcom/google/gwt/dom/client/Node;Lcom/google/gwt/core/client/JsArray;Lcom/google/gwt/core/client/JsArray;)(match[3], elem, null, null).length; + return !!@com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::select(Ljava/lang/String;Lcom/google/gwt/dom/client/Node;Lcom/google/gwt/core/client/JsArray;Lcom/google/gwt/core/client/JsArray;)(match[3], elem, null, null).length; }, header: function(elem){ return /h\d/i.test( elem.nodeName ); @@ -313,7 +314,7 @@ public class SelectorEngineSizzleGwt extends SelectorEngineImpl { if ( filter ) { return filter( elem, i, match, array ); } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::getText(Ljava/lang/Object;)([ elem ]) || "").indexOf(match[3]) >= 0; + return (elem.textContent || elem.innerText || @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::getText(Ljava/lang/Object;)([ elem ]) || "").indexOf(match[3]) >= 0; } else if ( name === "not" ) { var not = match[3]; @@ -324,7 +325,7 @@ public class SelectorEngineSizzleGwt extends SelectorEngineImpl { } return true; } else { - @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::error(Ljava/lang/String;)("Syntax error, unrecognized expression: " + name); + @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::error(Ljava/lang/String;)("Syntax error, unrecognized expression: " + name); } }, CHILD: function(elem, match){ @@ -450,7 +451,7 @@ public class SelectorEngineSizzleGwt extends SelectorEngineImpl { match = true; break; } - } else if ( @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::filter(Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;ZLjava/lang/Object;)( cur, [elem], false ).length > 0 ) { + } else if ( @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::filter(Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;ZLjava/lang/Object;)( cur, [elem], false ).length > 0 ) { match = elem; break; } @@ -548,7 +549,7 @@ public class SelectorEngineSizzleGwt extends SelectorEngineImpl { // Improper expression if ( expr === old ) { if ( anyFound == null ) { - @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::error(Ljava/lang/String;)(expr); + @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::error(Ljava/lang/String;)(expr); } else { break; } @@ -595,7 +596,7 @@ public class SelectorEngineSizzleGwt extends SelectorEngineImpl { ret += elem.nodeValue; // Traverse everything else, except comment nodes } else if ( elem.nodeType !== 8 ) { - ret += @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::getText(Ljava/lang/Object;)(elem.childNodes); + ret += @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::getText(Ljava/lang/Object;)(elem.childNodes); } } return ret; @@ -629,9 +630,9 @@ public class SelectorEngineSizzleGwt extends SelectorEngineImpl { } selector = $wnd.Expr.relative[selector] ? selector + "*" : selector; for ( var i = 0, l = root.length; i < l; i++ ) { - @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::select(Ljava/lang/String;Lcom/google/gwt/dom/client/Node;Lcom/google/gwt/core/client/JsArray;Lcom/google/gwt/core/client/JsArray;)(selector, root[i], tmpSet, null); + @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::select(Ljava/lang/String;Lcom/google/gwt/dom/client/Node;Lcom/google/gwt/core/client/JsArray;Lcom/google/gwt/core/client/JsArray;)(selector, root[i], tmpSet, null); } - return @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::filter(Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;ZLjava/lang/Object;)( later, tmpSet, false ); + return @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::filter(Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;ZLjava/lang/Object;)( later, tmpSet, false ); }-*/; private static native JsArray<Element> select(String selector, Node context, JsArray<Element> results, JsArray<Element> seed) /*-{ @@ -649,17 +650,17 @@ public class SelectorEngineSizzleGwt extends SelectorEngineImpl { } if ( parts.length > 1 && $wnd.Expr.match.POS.exec( selector ) ) { if ( parts.length === 2 && $wnd.Expr.relative[ parts[0] ] ) { - set = @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::posProcess(Ljava/lang/String;Lcom/google/gwt/dom/client/Node;)(parts[0] + parts[1], context); + set = @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::posProcess(Ljava/lang/String;Lcom/google/gwt/dom/client/Node;)(parts[0] + parts[1], context); } else { set = $wnd.Expr.relative[ parts[0] ] ? [ context ] : - @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::select(Ljava/lang/String;Lcom/google/gwt/dom/client/Node;Lcom/google/gwt/core/client/JsArray;Lcom/google/gwt/core/client/JsArray;)(parts.shift(), context, null, null); + @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::select(Ljava/lang/String;Lcom/google/gwt/dom/client/Node;Lcom/google/gwt/core/client/JsArray;Lcom/google/gwt/core/client/JsArray;)(parts.shift(), context, null, null); while ( parts.length ) { selector = parts.shift(); if ( $wnd.Expr.relative[ selector ] ) { selector += parts.shift(); } - set = @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::posProcess(Ljava/lang/String;Lcom/google/gwt/dom/client/Node;)(selector, set); + set = @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::posProcess(Ljava/lang/String;Lcom/google/gwt/dom/client/Node;)(selector, set); } } } else { @@ -667,16 +668,16 @@ public class SelectorEngineSizzleGwt extends SelectorEngineImpl { // (but not if it'll be faster if the inner selector is an ID) if ( !seed && parts.length > 1 && context.nodeType === 9 && $wnd.Expr.match.ID.test(parts[0]) && !$wnd.Expr.match.ID.test(parts[parts.length - 1]) ) { - var ret = @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::find(Ljava/lang/String;Lcom/google/gwt/dom/client/Node;)( parts.shift(), context); - context = ret.expr ? @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::filter(Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;ZLjava/lang/Object;)( ret.expr, ret.set, false )[0] : ret.set[0]; + var ret = @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::find(Ljava/lang/String;Lcom/google/gwt/dom/client/Node;)( parts.shift(), context); + context = ret.expr ? @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::filter(Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;ZLjava/lang/Object;)( ret.expr, ret.set, false )[0] : ret.set[0]; } if ( context ) { var ret = seed ? - { expr: parts.pop(), set: @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::makeArray(Lcom/google/gwt/dom/client/NodeList;Lcom/google/gwt/core/client/JsArray;)(seed, null) } : - @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::find(Ljava/lang/String;Lcom/google/gwt/dom/client/Node;)( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context); - set = ret.expr ? @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::filter(Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;ZLjava/lang/Object;)( ret.expr, ret.set, false ) : ret.set; + { expr: parts.pop(), set: @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::makeArray(Lcom/google/gwt/dom/client/NodeList;Lcom/google/gwt/core/client/JsArray;)(seed, null) } : + @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::find(Ljava/lang/String;Lcom/google/gwt/dom/client/Node;)( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context); + set = ret.expr ? @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::filter(Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;ZLjava/lang/Object;)( ret.expr, ret.set, false ) : ret.set; if ( parts.length > 0 ) { - checkSet = @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::makeArray(Lcom/google/gwt/dom/client/NodeList;Lcom/google/gwt/core/client/JsArray;)(set, null); + checkSet = @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::makeArray(Lcom/google/gwt/dom/client/NodeList;Lcom/google/gwt/core/client/JsArray;)(set, null); } else { prune = false; } @@ -700,14 +701,14 @@ public class SelectorEngineSizzleGwt extends SelectorEngineImpl { checkSet = set; } if ( !checkSet ) { - @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::error(Ljava/lang/String;)(cur || selector); + @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::error(Ljava/lang/String;)(cur || selector); } if ( Object.prototype.toString.call(checkSet) === "[object Array]" ) { if ( !prune ) { results.push.apply( results, checkSet ); } else if ( context && context.nodeType === 1 ) { for ( var i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::contains(Ljava/lang/Object;Ljava/lang/Object;)(context, checkSet[i])) ) { + if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::contains(Ljava/lang/Object;Ljava/lang/Object;)(context, checkSet[i])) ) { results.push( set[i] ); } } @@ -719,10 +720,10 @@ public class SelectorEngineSizzleGwt extends SelectorEngineImpl { } } } else { - @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::makeArray(Lcom/google/gwt/dom/client/NodeList;Lcom/google/gwt/core/client/JsArray;)(checkSet, results); + @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::makeArray(Lcom/google/gwt/dom/client/NodeList;Lcom/google/gwt/core/client/JsArray;)(checkSet, results); } if ( extra ) { - @com.google.gwt.query.client.impl.SelectorEngineSizzleGwt::select(Ljava/lang/String;Lcom/google/gwt/dom/client/Node;Lcom/google/gwt/core/client/JsArray;Lcom/google/gwt/core/client/JsArray;)(extra, origContext, results, seed); + @com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt::select(Ljava/lang/String;Lcom/google/gwt/dom/client/Node;Lcom/google/gwt/core/client/JsArray;Lcom/google/gwt/core/client/JsArray;)(extra, origContext, results, seed); } return results; }-*/; diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineXPath.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/research/SelectorEngineXPath.java index 6cc48dec..b2ba41f7 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/SelectorEngineXPath.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/research/SelectorEngineXPath.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.gwt.query.client.impl;
+package com.google.gwt.query.client.impl.research;
import static com.google.gwt.query.client.GQUtils.eq;
import static com.google.gwt.query.client.GQUtils.truth;
@@ -26,6 +26,9 @@ import com.google.gwt.query.client.GQUtils; import com.google.gwt.query.client.JSArray;
import com.google.gwt.query.client.Regexp;
import com.google.gwt.query.client.SelectorEngine;
+import com.google.gwt.query.client.impl.SelectorEngineImpl;
+import com.google.gwt.query.client.impl.research.SelectorEngineJS.Sequence;
+import com.google.gwt.query.client.impl.research.SelectorEngineJS.SplitRule;
/**
@@ -173,7 +176,7 @@ public class SelectorEngineXPath extends SelectorEngineImpl { + ")";
} else if (eq("nth-child", pseudoClass)) {
if (!eq("n", pseudoClass)) {
- Sequence sequence = getSequence(pseudoValue);
+ Sequence sequence = SelectorEngineJS.getSequence(pseudoValue);
if (sequence != null) {
if (sequence.start == sequence.max) {
xpath = "count(preceding-sibling::*) = " + (sequence.start - 1);
@@ -189,7 +192,7 @@ public class SelectorEngineXPath extends SelectorEngineImpl { }
} else if (eq("nth-of-type", pseudoClass)) {
if (!pseudoValue.startsWith("n")) {
- Sequence sequence = getSequence(pseudoValue);
+ Sequence sequence = SelectorEngineJS.getSequence(pseudoValue);
if (sequence != null) {
if (sequence.start == sequence.max) {
xpath = pseudoValue;
@@ -235,13 +238,13 @@ public class SelectorEngineXPath extends SelectorEngineImpl { if(!allAttr) return "";
return allAttr.replace(/["']+/g,'').replace(/(\w+)(\^|\$|\*|\||~)?=?([\w\u00C0-\uFFFF\s\-_\.]+)?/g,
function(a,b,c,d) {
- return @com.google.gwt.query.client.impl.SelectorEngineXPath::attrToXPath(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)(a,b || "",c || "",d || "");
+ return @com.google.gwt.query.client.impl.research.SelectorEngineXPath::attrToXPath(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)(a,b || "",c || "",d || "");
});
}-*/;
private native String replaceAttr2(String allAttr) /*-{
if(!allAttr) return "";
- return allAttr.replace(/\[(\w+)(\^|\$|\*|\||~)?=?([\w\u00C0-\uFFFF\s\-_\.]+)?\]/g, @com.google.gwt.query.client.impl.SelectorEngineXPath::attrToXPath(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;));
+ return allAttr.replace(/\[(\w+)(\^|\$|\*|\||~)?=?([\w\u00C0-\uFFFF\s\-_\.]+)?\]/g, @com.google.gwt.query.client.impl.research.SelectorEngineXPath::attrToXPath(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;));
}-*/;
}
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyWidgets.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyWidgets.java index 27ec1ee3..881e9d7f 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyWidgets.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyWidgets.java @@ -27,6 +27,6 @@ import com.google.gwt.query.client.LazyBase; public interface LazyWidgets<T> extends LazyBase<T>{ - Widget widget(); + <W extends Widget> W widget(); } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Widgets.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Widgets.java index 745a830b..713a73a3 100755 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Widgets.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Widgets.java @@ -56,8 +56,10 @@ public class Widgets extends GQueryQueue<Widgets> { super(list);
}
+ @SuppressWarnings("unchecked")
@Override
- public Widget widget() {
+ // TODO: consider more widgets
+ public <W extends Widget> W widget() {
Widget w = super.widget();
if (w == null) {
Element e = elements.getItem(0);
@@ -71,7 +73,7 @@ public class Widgets extends GQueryQueue<Widgets> { w = new HTML($(e).toString());
}
}
- return w;
+ return (W)w;
}
}
diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java index 061f8277..f7c54c50 100644 --- a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java +++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java @@ -19,6 +19,8 @@ import static com.google.gwt.query.client.GQuery.$; import static com.google.gwt.query.client.GQuery.$$; import static com.google.gwt.query.client.GQuery.document; +import java.util.ArrayList; + import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; import com.google.gwt.event.dom.client.ClickEvent; @@ -790,5 +792,40 @@ public class GQueryCoreTest extends GWTTestCase { (b2).click(); assertEquals("red", $(b1).css("color")); } + + public void testGQueryMap() { + String content = "<p id='1'/><p/><p id='2'/><p id='4'/>"; + $(e).html(content); + + ArrayList<String> s = $("p", e).map(new Function() { + public Object f(Element e, int i) { + return null; + } + }); + assertNotNull(s); + assertEquals(0, s.size()); + + s = $("p", e).map(new Function() { + public Object f(Element e, int i) { + String id = $(e).attr("id"); + return id.isEmpty() ? null: id; + } + }); + assertEquals(3, s.size()); + assertEquals("1", s.get(0)); + assertEquals("2", s.get(1)); + assertEquals("4", s.get(2)); + + + ArrayList<Element> a = $("p", e).map(new Function() { + public Object f(Element e, int i) { + String id = $(e).attr("id"); + return id.isEmpty() ? null: e; + } + }); + assertEquals(3, a.size()); + assertEquals(3, $(a).size()); + + } } diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQuerySelectorsTest.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQuerySelectorsTest.java index 79aca34b..4efe789b 100644 --- a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQuerySelectorsTest.java +++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQuerySelectorsTest.java @@ -27,11 +27,11 @@ import com.google.gwt.dom.client.NodeList; import com.google.gwt.junit.client.GWTTestCase; import com.google.gwt.query.client.impl.SelectorEngineCssToXPath; import com.google.gwt.query.client.impl.SelectorEngineImpl; -import com.google.gwt.query.client.impl.SelectorEngineJS; import com.google.gwt.query.client.impl.SelectorEngineNative; import com.google.gwt.query.client.impl.SelectorEngineSizzle; -import com.google.gwt.query.client.impl.SelectorEngineSizzleGwt; -import com.google.gwt.query.client.impl.SelectorEngineXPath; +import com.google.gwt.query.client.impl.research.SelectorEngineJS; +import com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt; +import com.google.gwt.query.client.impl.research.SelectorEngineXPath; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.RootPanel; diff --git a/plugins/pom.xml b/plugins/pom.xml deleted file mode 100644 index 24fe56f3..00000000 --- a/plugins/pom.xml +++ /dev/null @@ -1,31 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>com.google.gwt</groupId> - <artifactId>gwtquery-project</artifactId> - <version>1.0.0-SNAPSHOT</version> - </parent> - - <name>GwtQuery Plugins</name> - <artifactId>gwtquery-plugins</artifactId> - <packaging>jar</packaging> - <dependencies> - <dependency> - <groupId>${groupId}</groupId> - <artifactId>gwtquery</artifactId> - <version>${version}</version> - </dependency> - </dependencies> - <build> - <resources> - <resource> - <directory>${basedir}/src/main/java</directory> - </resource> - <resource> - <directory>${basedir}/src/main/resources</directory> - </resource> - </resources> - </build> -</project> diff --git a/plugins/src/main/java/gwtquery/Plugins.gwt.xml b/plugins/src/main/java/gwtquery/Plugins.gwt.xml deleted file mode 100644 index 6dba0da2..00000000 --- a/plugins/src/main/java/gwtquery/Plugins.gwt.xml +++ /dev/null @@ -1,6 +0,0 @@ -<module> - <inherits name='com.google.gwt.query.Query'/> - <source path="plugins"/> -</module> - - diff --git a/plugins/src/main/java/gwtquery/plugins/collapser/Collapser.java b/plugins/src/main/java/gwtquery/plugins/collapser/Collapser.java deleted file mode 100644 index 8cdc995b..00000000 --- a/plugins/src/main/java/gwtquery/plugins/collapser/Collapser.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2009 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package gwtquery.plugins.collapser; - -import com.google.gwt.dom.client.Element; -import com.google.gwt.dom.client.NodeList; -import com.google.gwt.query.client.Function; -import com.google.gwt.query.client.GQuery; -import com.google.gwt.query.client.Plugin; -import com.google.gwt.query.client.plugins.Effects; -import com.google.gwt.user.client.Event; - -/** - * Collapser sample plugin. For all matched elements, adds a clickable [X] next - * to the element which toggles its visibility. - */ -public class Collapser extends GQuery { - - /** - * Used to register the plugin. - */ - private static class CollapserPlugin implements Plugin<Collapser> { - - public Collapser init(GQuery gq) { - return new Collapser(gq.get()); - } - } - - /** - * Plugin key for Collapser. - */ - public static final Class<Collapser> Collapser = Collapser.class; - - static { - GQuery.registerPlugin(Collapser.class, new CollapserPlugin()); - } - - public Collapser(NodeList<Element> list) { - super(list); - } - - /** - * Adds a [X] link button before each matched element with a bound click - * handler that toggles visibility of the element. - */ - public Collapser apply() { - for (final Element e : elements()) { - GQuery button = $("<a href='#'>[X]</a>"); - $(e).before(button); - button.click(new Function() { - public boolean f(Event evt) { - $(e).as(Effects.Effects).toggle(); - return true; - } - }); - } - - return this; - } -}
\ No newline at end of file diff --git a/plugins/src/main/java/gwtquery/plugins/widgets/Widgets.java b/plugins/src/main/java/gwtquery/plugins/widgets/Widgets.java deleted file mode 100644 index b1103ed3..00000000 --- a/plugins/src/main/java/gwtquery/plugins/widgets/Widgets.java +++ /dev/null @@ -1,107 +0,0 @@ -package gwtquery.plugins.widgets; - -import com.google.gwt.dom.client.Element; -import com.google.gwt.dom.client.NodeList; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.query.client.GQuery; -import com.google.gwt.query.client.JSArray; -import com.google.gwt.query.client.Plugin; -import com.google.gwt.user.client.ui.Button; - -import java.util.ArrayList; -import java.util.Collection; - -/** - * Experimental Gwt Query plugin for integrating Gwt Widgets. - */ -public class Widgets extends GQuery { - - /** - * Used to register the plugin. - */ - private static class WidgetsPlugin implements Plugin<Widgets> { - - public Widgets init(GQuery gq) { - return new Widgets(gq.get()); - } - } - - public static final Class<Widgets> Widgets = Widgets.class; - - static { - GQuery.registerPlugin(Widgets.class, new WidgetsPlugin()); - } - - public Widgets(Element element) { - super(element); - } - - public Widgets(JSArray elements) { - super(elements); - } - - public Widgets(NodeList list) { - super(list); - } - - /** - * Create a builder capable of instantiating a GWT Button object over every - * matched element. Call end() to execute builder and return to the current - * query object. - * - * @return a ButtonBuilder - */ - public ButtonBuilder button() { - return new ButtonBuilder("*"); - } - - public class ButtonBuilder { - - private String selector; - - private String label = null; - - private String labelSelector = null; - - private Collection<ClickHandler> handlers = new ArrayList<ClickHandler>(); - - public ButtonBuilder(String selector) { - this.selector = selector; - } - - public ButtonBuilder labelQuery(String label) { - this.labelSelector = label; - return this; - } - - public ButtonBuilder label(String label) { - this.label = label; - return this; - } - - public ButtonBuilder addClickHandler(ClickHandler handler) { - handlers.add(handler); - return this; - } - - public Widgets end() { - for (Element e : elements()) { - Button b = null; - if ("button".equalsIgnoreCase(e.getTagName())) { - b = Button.wrap(e); - } else { - Element bElt = $("<button name='button' value='Click Me'>").get(0); - $(e).hide().before(bElt); - b = Button.wrap(bElt); - } - - b.setText(label != null ? label - : (labelSelector == null ? $(e) : $(labelSelector, e)).text()); - for (ClickHandler handler : handlers) { - b.addClickHandler(handler); - } - } - return Widgets.this; - } - } -} @@ -52,7 +52,6 @@ <modules> <module>gwtquery-core</module> - <!-- <module>plugins</module> --> <!-- <module>samples</module> --> <!-- <module>devtest</module> --> </modules> @@ -145,8 +144,8 @@ </repositories> <properties> - <gwtversion>2.1.0</gwtversion> - <gwt.loglevel>ERROR</gwt.loglevel> + <gwtversion>2.1.1</gwtversion> + <gwt.loglevel>INFO</gwt.loglevel> <gwt.outputstyle>OBF</gwt.outputstyle> <gwt.modulesuffix></gwt.modulesuffix> </properties> @@ -155,7 +154,6 @@ <profile> <id>dev</id> <properties> - <gwt.loglevel>WARN</gwt.loglevel> <gwt.outputstyle>PRETTY</gwt.outputstyle> </properties> </profile> diff --git a/samples/pom.xml b/samples/pom.xml index b96192ee..376724dd 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <groupId>com.google.gwt</groupId> + <groupId>com.googlecode.gwtquery</groupId> <artifactId>gwtquery-project</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> @@ -19,14 +19,21 @@ <type>jar</type> <scope>provided</scope> </dependency> - <dependency> - <groupId>${groupId}</groupId> - <artifactId>gwtquery-plugins</artifactId> - <version>${version}</version> - <type>jar</type> + <groupId>com.google.gwt</groupId> + <artifactId>gwt-user</artifactId> + <version>${gwtversion}</version> <scope>provided</scope> </dependency> + + +<!-- <dependency>--> +<!-- <groupId>${groupId}</groupId>--> +<!-- <artifactId>gwtquery-plugins</artifactId>--> +<!-- <version>${version}</version>--> +<!-- <type>jar</type>--> +<!-- <scope>provided</scope>--> +<!-- </dependency>--> </dependencies> <build> <plugins> @@ -37,14 +44,15 @@ <logLevel>${gwt.loglevel}</logLevel> <style>${gwt.outputstyle}</style> <gwtVersion>${gwtversion}</gwtVersion> - <soyc>false</soyc> + <compileReport>true</compileReport> <modules> + <module>gwtquery.samples.GwtQueryDemo</module> <module>gwtquery.samples.GwtQueryEffects</module> + <module>gwtquery.samples.GwtQueryEffectsMin</module> <module>gwtquery.samples.GwtQuerySample</module> <module>gwtquery.samples.GwtQueryBench</module> - <module>gwtquery.samples.GwtQueryDemo</module> <module>gwtquery.samples.GwtQueryWidgets</module> - <module>gwtquery.samples.GwtQueryImageZoom</module> + <module>gwtquery.samples.GwtQueryImageZoom</module> </modules> </configuration> <executions> @@ -63,6 +71,7 @@ <fileset><directory>src/main/webapp/gwtquery.samples.GwtQueryBench</directory></fileset> <fileset><directory>src/main/webapp/gwtquery.samples.GwtQueryDemo</directory></fileset> <fileset><directory>src/main/webapp/gwtquery.samples.GwtQueryEffects</directory></fileset> + <fileset><directory>src/main/webapp/gwtquery.samples.GwtQueryEffectsMin</directory></fileset> <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> @@ -75,6 +84,27 @@ </filesets> </configuration> </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-eclipse-plugin</artifactId> + <configuration> + <downloadSources>true</downloadSources> + <downloadJavadocs>true</downloadJavadocs> + <additionalBuildcommands> + <buildCommand> + <name> + com.google.gwt.eclipse.core.gwtProjectValidator + </name> + </buildCommand> + </additionalBuildcommands> + <additionalProjectnatures> + <projectnature>com.google.gwt.eclipse.core.gwtNature + </projectnature> + </additionalProjectnatures> + </configuration> + </plugin> + </plugins> </build> diff --git a/samples/src/main/java/gwtquery/samples/GwtQueryBench.gwt.xml b/samples/src/main/java/gwtquery/samples/GwtQueryBench.gwt.xml index 66ea7a44..921732a7 100644 --- a/samples/src/main/java/gwtquery/samples/GwtQueryBench.gwt.xml +++ b/samples/src/main/java/gwtquery/samples/GwtQueryBench.gwt.xml @@ -1,6 +1,5 @@ <module> <inherits name='com.google.gwt.query.Query'/> - <inherits name='gwtquery.Plugins'/> <entry-point class='gwtquery.samples.client.GwtQueryBenchModule'/> </module> diff --git a/samples/src/main/java/gwtquery/samples/GwtQueryDemo.gwt.xml b/samples/src/main/java/gwtquery/samples/GwtQueryDemo.gwt.xml index e367b228..d4456538 100644 --- a/samples/src/main/java/gwtquery/samples/GwtQueryDemo.gwt.xml +++ b/samples/src/main/java/gwtquery/samples/GwtQueryDemo.gwt.xml @@ -1,6 +1,5 @@ <module> <inherits name='com.google.gwt.query.Query'/> - <inherits name='gwtquery.Plugins'/> <entry-point class='gwtquery.samples.client.GwtQueryDemoModule'/> </module> diff --git a/samples/src/main/java/gwtquery/samples/GwtQueryEffects.gwt.xml b/samples/src/main/java/gwtquery/samples/GwtQueryEffects.gwt.xml index 0ce4dcad..39578f05 100644 --- a/samples/src/main/java/gwtquery/samples/GwtQueryEffects.gwt.xml +++ b/samples/src/main/java/gwtquery/samples/GwtQueryEffects.gwt.xml @@ -1,6 +1,5 @@ <module> <inherits name='com.google.gwt.query.Query'/> - <inherits name='gwtquery.Plugins'/> <entry-point class='gwtquery.samples.client.GwtQueryEffectsModule'/> </module> diff --git a/samples/src/main/java/gwtquery/samples/GwtQueryEffectsMin.gwt.xml b/samples/src/main/java/gwtquery/samples/GwtQueryEffectsMin.gwt.xml new file mode 100644 index 00000000..ee40909c --- /dev/null +++ b/samples/src/main/java/gwtquery/samples/GwtQueryEffectsMin.gwt.xml @@ -0,0 +1,5 @@ +<module> + <inherits name='com.google.gwt.query.QueryMin'/> + <entry-point class='gwtquery.samples.client.GwtQueryEffectsModule'/> +</module> + diff --git a/samples/src/main/java/gwtquery/samples/GwtQueryImageZoom.gwt.xml b/samples/src/main/java/gwtquery/samples/GwtQueryImageZoom.gwt.xml index 233f3321..7fe8b07d 100644 --- a/samples/src/main/java/gwtquery/samples/GwtQueryImageZoom.gwt.xml +++ b/samples/src/main/java/gwtquery/samples/GwtQueryImageZoom.gwt.xml @@ -1,6 +1,5 @@ <module> <inherits name='com.google.gwt.query.Query'/> - <inherits name='gwtquery.Plugins'/> <entry-point class='gwtquery.samples.client.GwtQueryImageZoom'/> </module> diff --git a/samples/src/main/java/gwtquery/samples/GwtQuerySample.gwt.xml b/samples/src/main/java/gwtquery/samples/GwtQuerySample.gwt.xml index 344d7a6b..af51bf7d 100644 --- a/samples/src/main/java/gwtquery/samples/GwtQuerySample.gwt.xml +++ b/samples/src/main/java/gwtquery/samples/GwtQuerySample.gwt.xml @@ -1,7 +1,5 @@ <module> <inherits name='com.google.gwt.query.Query'/> - <inherits name='gwtquery.Plugins'/> -<!-- <set-property name="user.agent" value="gecko1_8"/>--> <entry-point class='gwtquery.samples.client.GwtQuerySampleModule'/> </module> diff --git a/samples/src/main/java/gwtquery/samples/GwtQueryWidgets.gwt.xml b/samples/src/main/java/gwtquery/samples/GwtQueryWidgets.gwt.xml index d9d0673c..ea6ddd04 100644 --- a/samples/src/main/java/gwtquery/samples/GwtQueryWidgets.gwt.xml +++ b/samples/src/main/java/gwtquery/samples/GwtQueryWidgets.gwt.xml @@ -1,6 +1,5 @@ <module> <inherits name='com.google.gwt.query.Query'/> - <inherits name='gwtquery.Plugins'/> <entry-point class='gwtquery.samples.client.GwtQueryWidgetModule'/> </module> diff --git a/samples/src/main/java/gwtquery/samples/client/GwtQueryBenchModule.java b/samples/src/main/java/gwtquery/samples/client/GwtQueryBenchModule.java index 7f00702f..a692e076 100644 --- a/samples/src/main/java/gwtquery/samples/client/GwtQueryBenchModule.java +++ b/samples/src/main/java/gwtquery/samples/client/GwtQueryBenchModule.java @@ -13,13 +13,13 @@ import com.google.gwt.query.client.Function; import com.google.gwt.query.client.GQuery;
import com.google.gwt.query.client.impl.SelectorEngineCssToXPath;
import com.google.gwt.query.client.impl.SelectorEngineImpl;
-import com.google.gwt.query.client.impl.SelectorEngineJS;
import com.google.gwt.query.client.impl.SelectorEngineNative;
import com.google.gwt.query.client.impl.SelectorEngineNativeIE8;
import com.google.gwt.query.client.impl.SelectorEngineSizzle;
-import com.google.gwt.query.client.impl.SelectorEngineSizzleGwt;
import com.google.gwt.query.client.impl.SelectorEngineSizzleIE;
-import com.google.gwt.query.client.impl.SelectorEngineXPath;
+import com.google.gwt.query.client.impl.research.SelectorEngineJS;
+import com.google.gwt.query.client.impl.research.SelectorEngineSizzleGwt;
+import com.google.gwt.query.client.impl.research.SelectorEngineXPath;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.IncrementalCommand;
diff --git a/samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java b/samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java index b0df016c..a3b5f955 100644 --- a/samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java +++ b/samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java @@ -1,30 +1,39 @@ package gwtquery.samples.client;
+import static com.google.gwt.query.client.GQuery.$;
+
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.query.client.Function;
-import static com.google.gwt.query.client.GQuery.$;
+import com.google.gwt.query.client.GQuery;
+import com.google.gwt.query.client.plugins.Widgets;
+import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Window;
-
-import static gwtquery.plugins.widgets.Widgets.Widgets;
+import com.google.gwt.user.client.ui.Button;
public class GwtQueryWidgetModule implements EntryPoint {
public void onModuleLoad() {
-
- $(".outer").eq(0).after("<button id='enhance'>Enhance</button>");
- $("#enhance").one(Event.ONCLICK, null, new Function() {
- @Override
+ $("<button>Enhance</button>").appendTo(".outer").one(Event.ONCLICK, null, new Function() {
public boolean f(Event e) {
- $(".btn:nth-child(odd)").as(Widgets).button().label("Foo")
- .addClickHandler(new ClickHandler() {
+ $(".btn:nth-child(odd)").each(new Function(){
+ public void f(Element el) {
+ // Replace odd labels by a button
+ GQuery g = $("<button/>");
+ $(el).hide().after(g);
+
+ // Use the Widgets plugin to convert the button element to a button.
+ Button b = g.as(Widgets.Widgets).widget();
+ b.setText("Foo");
+ b.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
Window.alert("You Clicked the Button");
}
- }).end();
-
+ });
+ }
+ });
return true;
}
});
diff --git a/samples/src/main/java/gwtquery/samples/public/GwtQueryEffectsMin.html b/samples/src/main/java/gwtquery/samples/public/GwtQueryEffectsMin.html new file mode 100644 index 00000000..07736bc1 --- /dev/null +++ b/samples/src/main/java/gwtquery/samples/public/GwtQueryEffectsMin.html @@ -0,0 +1,65 @@ +<!--<!doctype html>-->
+
+<html>
+<head>
+ <title>GQuery Demo</title>
+ <script language="javascript"
+ src="gwtquery.samples.GwtQueryEffectsMin.nocache.js"></script>
+ <style type="text/css">
+ .box {
+ border-style: groove;
+ border-color: green;
+ border-width: 5px;
+ }
+ .a {
+ border-style: solid;
+ border-color: black;
+ border-width: 7px;
+ background: pink;
+ width: 50%;
+ padding: 10px;
+ display: none;
+ }
+ </style>
+</head>
+<body>
+<div class="outer">
+ <div>Foo <span class="note">bar</span> baz</div>
+ <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
+ <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
+ <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
+ <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
+ <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
+ <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
+ <div>Foo <span class="note">bar</span> <span class="xyz">baz</span></div>
+</div>
+<br/>
+<button id="b0">Animate me</button><br/>
+<button id="b1">Toggle Animate effects</button>
+<button id="b2">Toggle Clip effects</button>
+<br/>
+<br/>
+<div class="a">
+<span id="i1" class="box">Span 1</span>
+<span id="i2" class="box">Span 2</span>
+<span id="i3" class="box">Span 3</span>
+</div>
+<br/>
+<div class="b">
+<div class="box">Div 1</div>
+<div class="box">Div 2</div>
+<div class="box">Div 3</div>
+<div class="box">Div 4</div>
+</div>
+
+<script src="jquery-1.3.1.js"></script>
+<script>
+// $("#b1").click(function(){
+// $("#i1").animate(({width: '70%', opacity: '0.4', marginLeft: '0.6in', fontSize: '3em', borderWidth: '10px'}));
+// });
+</script>
+
+
+</body>
+</html>
+
\ No newline at end of file diff --git a/samples/src/main/java/gwtquery/samples/public/GwtQueryWidgets.html b/samples/src/main/java/gwtquery/samples/public/GwtQueryWidgets.html index d47bca9e..a414cf94 100644 --- a/samples/src/main/java/gwtquery/samples/public/GwtQueryWidgets.html +++ b/samples/src/main/java/gwtquery/samples/public/GwtQueryWidgets.html @@ -3,8 +3,6 @@ <title>GQuery Demo</title>
<script language="javascript"
src="gwtquery.samples.GwtQueryWidgets.nocache.js"></script>
- <link href='gquery-star-ratings.css' type="text/css" rel="stylesheet"/>
-
</head>
<body>
<div class="outer">
diff --git a/samples/src/main/webapp/index.html b/samples/src/main/webapp/index.html index 4c3285cb..03f17029 100644 --- a/samples/src/main/webapp/index.html +++ b/samples/src/main/webapp/index.html @@ -14,6 +14,7 @@ <li><a href="javascript:goTo('gwtquery.samples.GwtQuerySample/GwtQuerySample.html')">gwtquery.samples.GwtQuerySample/GwtQuerySample.html</a></li> <li><a href="javascript:goTo('gwtquery.samples.GwtQueryDemo/GwtQueryDemo.html')">gwtquery.samples.GwtQueryDemo/GwtQueryDemo.html</a></li> <li><a href="javascript:goTo('gwtquery.samples.GwtQueryEffects/GwtQueryEffects.html')">gwtquery.samples.GwtQueryEffects/GwtQueryEffects.html</a></li> +<li><a href="javascript:goTo('gwtquery.samples.GwtQueryEffectsMin/GwtQueryEffectsMin.html')">gwtquery.samples.GwtQueryEffects/GwtQueryEffectsMin.html</a></li> <li><a href="javascript:goTo('gwtquery.samples.GwtQueryWidgets/GwtQueryWidgets.html')">gwtquery.samples.GwtQueryWidgets/GwtQueryWidgets.html</a></li> <li><a href="javascript:goTo('gwtquery.samples.GwtQueryBench/GwtQueryBench.html')">gwtquery.samples.GwtQueryBench/GwtQueryBench.html</a></li> <li><a href="javascript:goTo('gwtquery.samples.GwtQueryImageZoom/GwtQueryImageZoom.html')">gwtquery.samples.GwtQueryImageZomm/GwtQueryImageZoom.html</a></li> |