System.err.println("GQuery.$(Object o) could not wrap the type : " + o.getClass());
}
}
+
return $();
}
* Return true if the element b is contained in a.
*/
public static boolean contains(Element a, Element b) {
+ maybeInitializeSelectorEngine();
return engine.contains(a, b);
}
return new Deferred();
}
+ private static void maybeInitializeSelectorEngine() {
+ if (engine == null) {
+ engine = new SelectorEngine();
+ }
+ }
+
private static native void scrollIntoViewImpl(Node n) /*-{
if (n)
n.scrollIntoView()
public GQuery has(final Element elem) {
return filter(new Predicate() {
public boolean f(Element e, int index) {
- return engine.contains(e, elem);
+ return contains(e, elem);
}
});
}
}
private GQuery select(String selector, Node context) {
- if (engine == null) {
- engine = new SelectorEngine();
- }
+ maybeInitializeSelectorEngine();
NodeList<Element> n = engine.select(selector, context == null ? document : context);
currentSelector = selector;