/** * 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). */ public GQuery after(String html) { return domManip(html, DomMan.AFTER); }
/** * Prepend content to the inside of every matched element. This operation is the best way to * insert elements inside, at the beginning, of all matched elements. */ public GQuery prepend(GQuery query) { return domManip(query, DomMan.PREPEND); }
/** * Insert content before each of the matched elements. The elements must already be inserted into * the document (you can't insert an element before another if it's not in the page). */ public GQuery before(GQuery query) { return domManip(query, DomMan.BEFORE); }
/** * 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. */ public GQuery append(String html) { return domManip(html, DomMan.APPEND); }
/** * Insert content before each of the matched elements. The elements must already be inserted into * the document (you can't insert an element before another if it's not in the page). */ public GQuery before(String html) { return domManip(html, DomMan.BEFORE); }
/** * 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). */ public GQuery after(GQuery query) { return domManip(query, DomMan.AFTER); }
/** * 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. */ public GQuery append(GQuery query) { return domManip(query, DomMan.APPEND); }
/** * Prepend content to the inside of every matched element. This operation is the best way to * insert elements inside, at the beginning, of all matched elements. */ public GQuery prepend(String html) { return domManip(html, DomMan.PREPEND); }
/** * 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). */ public GQuery after(Node n) { return domManip($(n), DomMan.AFTER); }
/** * 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. */ public GQuery append(Node n) { return domManip($(n), DomMan.APPEND); }
/** * Insert content before each of the matched elements. The elements must already be inserted into * the document (you can't insert an element before another if it's not in the page). */ public GQuery before(Node n) { return domManip($(n), DomMan.BEFORE); }
/** * Prepend content to the inside of every matched element. This operation is the best way to * insert elements inside, at the beginning, of all matched elements. */ public GQuery prepend(Node n) { return domManip($(n), DomMan.PREPEND); }
private GQuery domManip(String htmlString, DomMan type) { JsMap<Document, GQuery> cache = JsMap.createObject().cast(); for (Element e : elements) { Document d = JsUtils.getOwnerDocument(e); GQuery g = cache.get(d); if (g == null) { g = cleanHtmlString(htmlString, d); cache.put(d, g); } domManip(g.clone(), type, e); } return this; }