if (o instanceof String) {
return $((String) o);
}
+ if (o instanceof SafeHtml) {
+ return $(((SafeHtml) o).asString());
+ }
if (o instanceof GQuery) {
return (GQuery) o;
}
return $(selectorOrHtml, document);
}
- /**
- * This function accepts a SafeHtml creating a GQuery element containing those elements.
- */
- public static GQuery $(SafeHtml safeHtml) {
- return $(safeHtml.asString());
- }
-
/**
* This function accepts a string containing a CSS selector which is then used to match a set of
* elements, or it accepts raw HTML creating a GQuery element containing those elements. The
* its structure -- it is that element that will enwrap everything else.
*/
public GQuery wrap(SafeHtml safeHtml) {
- return wrap(safeHtml.asString());
+ return wrap($(safeHtml));
}
/**
import com.google.gwt.query.client.js.JsNodeArray;
import com.google.gwt.query.client.plugins.Effects;
import com.google.gwt.query.client.plugins.effects.PropertiesAnimation.Easing;
+import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.user.client.ui.Widget;
import java.util.List;
*/
LazyGQuery<T> after(String html);
+ /**
+ * Insert content after each of the matched elements. The elements must already be inserted into
+ * the document (you can't insert an element after another if it's not in the page).
+ */
+ LazyGQuery<T> after(SafeHtml safeHtml);
+
/**
*
* The animate() method allows you to create animation effects on any numeric HTML Attribute,
*/
LazyGQuery<T> append(String html);
+ /**
+ * Append content to the inside of every matched element. This operation is similar to doing an
+ * appendChild to all the specified elements, adding them into the document.
+ */
+ LazyGQuery<T> append(SafeHtml safeHtml);
+
/**
* All of the matched set of elements will be inserted at the end of the element(s) specified by
* the parameter other.
*/
LazyGQuery<T> appendTo(String html);
+ /**
+ * All of the matched set of elements will be inserted at the end of the element(s) specified by
+ * the parameter other.
+ *
+ * The operation $(A).appendTo(B) is, essentially, the reverse of doing a regular $(A).append(B),
+ * instead of appending B to A, you're appending A to B.
+ */
+ LazyGQuery<T> appendTo(SafeHtml safeHtml);
+
/**
* Convert to Plugin interface provided by Class literal.
*/
*/
LazyGQuery<T> html(String html);
+ /**
+ * Set the innerHTML of every matched element.
+ */
+ LazyGQuery<T> html(SafeHtml safeHtml);
+
/**
* Get the id of the first matched element.
*/
*/
LazyGQuery<T> queue(String queueName, Function... f);
+ /**
+ * Specify a function to execute when the DOM is fully loaded.
+ *
+ * While JavaScript provides the load event for executing code when a page is rendered, this event
+ * is not seen if we attach an event listener after the document has been loaded.
+ * This guarantees that our gwt code will be executed either it's executed synchronously before the
+ * DOM has been rendered (ie: single script linker in header) or asynchronously.
+ */
+ Promise ready(Function... fncs);
+
/**
* Removes all matched elements from the DOM.
*/
*/
LazyGQuery<T> wrap(String html);
+ /**
+ * Wrap each matched element with the specified SafeHtml content. This wrapping process is most useful
+ * for injecting additional structure into a document, without ruining the original semantic
+ * qualities of a document. This works by going through the first element provided (which is
+ * generated, on the fly, from the provided SafeHtml) and finds the deepest descendant element within
+ * its structure -- it is that element that will enwrap everything else.
+ */
+ LazyGQuery<T> wrap(SafeHtml safeHtml);
+
/**
* Wrap all the elements in the matched set into a single wrapper element. This is different from
* .wrap() where each element in the matched set would get wrapped with an element. This wrapping
*/
LazyGQuery<T> wrapAll(String html);
+ /**
+ * Wrap all the elements in the matched set into a single wrapper element. This is different from
+ * .wrap() where each element in the matched set would get wrapped with an element. This wrapping
+ * process is most useful for injecting additional structure into a document, without ruining the
+ * original semantic qualities of a document.
+ *
+ * This works by going through the first element provided (which is generated, on the fly, from
+ * the provided SafeHtml) and finds the deepest descendant element within its structure -- it is that
+ * element that will enwrap everything else.
+ */
+ LazyGQuery<T> wrapAll(SafeHtml safeHtml);
+
/**
* Wrap the inner child contents of each matched element (including text nodes) with an HTML
* structure. This wrapping process is most useful for injecting additional structure into a
*/
LazyGQuery<T> wrapInner(String html);
+ /**
+ * Wrap the inner child contents of each matched element (including text nodes) with an SafeHtml
+ * structure. This wrapping process is most useful for injecting additional structure into a
+ * document, without ruining the original semantic qualities of a document. This works by going
+ * through the first element provided (which is generated, on the fly, from the provided SafeHtml) and
+ * finds the deepest ancestor element within its structure -- it is that element that will enwrap
+ * everything else.
+ */
+ LazyGQuery<T> wrapInner(SafeHtml safeHtml);
+
}