aboutsummaryrefslogtreecommitdiffstats
path: root/gwtquery-core
diff options
context:
space:
mode:
authorjdramaix <julien.dramaix@gmail.com>2014-02-02 12:33:37 +0100
committerjdramaix <julien.dramaix@gmail.com>2014-02-02 12:33:37 +0100
commit0be3dde6cd3de70fbace8f3aa7cb196ddf85f09b (patch)
treee9c936aebf989722ec470c2559697dc17a17130f /gwtquery-core
parentcbffbdd7cd4a319620583bff71e437cc9e413fe5 (diff)
downloadgwtquery-0be3dde6cd3de70fbace8f3aa7cb196ddf85f09b.tar.gz
gwtquery-0be3dde6cd3de70fbace8f3aa7cb196ddf85f09b.zip
code review comments
Diffstat (limited to 'gwtquery-core')
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java12
1 files changed, 6 insertions, 6 deletions
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 cb6d74cf..bd29b38c 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
@@ -492,8 +492,7 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
* 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);
}
/**
@@ -766,10 +765,12 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
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) /*-{
@@ -4145,9 +4146,8 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
}
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);