* 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 getSelectorEngine().contains(a, b);
}
/**
return new Deferred();
}
- private static void maybeInitializeSelectorEngine() {
+ private static SelectorEngine getSelectorEngine() {
if (engine == null) {
engine = new SelectorEngine();
}
+
+ return engine;
}
private static native void scrollIntoViewImpl(Node n) /*-{
}
private GQuery select(String selector, Node context) {
- maybeInitializeSelectorEngine();
-
- NodeList<Element> n = engine.select(selector, context == null ? document : context);
+ NodeList<Element> n = getSelectorEngine().select(selector, context == null ? document :
+ context);
currentSelector = selector;
currentContext = context != null ? context : document;
return setArray(n);