*/\r
package com.google.gwt.query.client.impl;\r
\r
+import com.google.gwt.core.client.JavaScriptObject;\r
import com.google.gwt.core.client.JsArray;\r
import com.google.gwt.dom.client.Document;\r
import com.google.gwt.dom.client.Element;\r
}\r
\r
private static NodeList<Element> getElementsByTagName(String tag, Node ctx) {\r
+ if (ctx == null) {\r
+ return JavaScriptObject.createArray().cast();\r
+ }\r
return ((Element) ctx).getElementsByTagName(tag);\r
}\r
\r
$("*", e).wrap("<b></b>");
assertHtmlEquals(expected, $(e).html());
}
+
+ public void testFilterBody() {
+ GQuery myNewElement = $("<div>my new div</div>");
+ boolean isAttachedToTheDOM = myNewElement.parents().filter("body").size() > 0;
+ assertEquals(false, isAttachedToTheDOM);
+
+ myNewElement.appendTo(document);
+ isAttachedToTheDOM = myNewElement.parents().filter("body").size() > 0;
+ assertEquals(true, isAttachedToTheDOM);
+ }
}