From 0be3dde6cd3de70fbace8f3aa7cb196ddf85f09b Mon Sep 17 00:00:00 2001 From: jdramaix Date: Sun, 2 Feb 2014 12:33:37 +0100 Subject: [PATCH] code review comments --- .../java/com/google/gwt/query/client/GQuery.java | 12 ++++++------ 1 file 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 { * 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 { 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 { } private GQuery select(String selector, Node context) { - maybeInitializeSelectorEngine(); - - NodeList n = engine.select(selector, context == null ? document : context); + NodeList n = getSelectorEngine().select(selector, context == null ? document : + context); currentSelector = selector; currentContext = context != null ? context : document; return setArray(n); -- 2.39.5