/** * Inserts content, specified by the parameter, to the end of each * element in the set of matched elements. */ public Jerry append(String html) { if (html == null) { html = StringPool.EMPTY; } final Document doc = builder.parse(html); if (nodes.length == 0) { return this; } for (Node node : nodes) { Document workingDoc = doc.clone(); node.addChild(workingDoc.getChildNodes()); } return this; }
/** * Insert content, specified by the parameter, to the beginning of each * element in the set of matched elements. */ public Jerry prepend(String html) { if (html == null) { html = StringPool.EMPTY; } final Document doc = builder.parse(html); if (nodes.length == 0) { return this; } for (Node node : nodes) { Document workingDoc = doc.clone(); node.insertChild(workingDoc.getChildNodes(), 0); } return this; }
/** * Inserts content, specified by the parameter, before each * element in the set of matched elements. */ public Jerry before(String html) { if (html == null) { html = StringPool.EMPTY; } final Document doc = builder.parse(html); if (nodes.length == 0) { return this; } for (Node node : nodes) { Document workingDoc = doc.clone(); node.insertBefore(workingDoc.getChildNodes(), node); } return this; }
/** * Inserts content, specified by the parameter, after each * element in the set of matched elements. */ public Jerry after(String html) { if (html == null) { html = StringPool.EMPTY; } final Document doc = builder.parse(html); if (nodes.length == 0) { return this; } for (Node node : nodes) { Document workingDoc = doc.clone(); node.insertAfter(workingDoc.getChildNodes(), node); } return this; }
/** * Sets the HTML contents of each element in the set of matched elements. */ public Jerry html(String html) { if (html == null) { html = StringPool.EMPTY; } final Document doc = builder.parse(html); if (nodes.length == 0) { return this; } for (Node node : nodes) { node.removeAllChilds(); // clone to preserve for next iteration // as nodes will be detached from parent Document workingDoc = doc.clone(); node.addChild(workingDoc.getChildNodes()); } return this; }
/** * Inserts content, specified by the parameter, to the end of each * element in the set of matched elements. */ public Jerry append(String html) { final Document doc = builder.parse(html); for (Node node : nodes) { Document workingDoc = doc.clone(); node.addChild(workingDoc.getChildNodes()); } return this; }
/** * Inserts content, specified by the parameter, before each * element in the set of matched elements. */ public Jerry before(String html) { final Document doc = builder.parse(html); for (Node node : nodes) { Document workingDoc = doc.clone(); node.insertBefore(workingDoc.getChildNodes(), node); } return this; }
/** * Inserts content, specified by the parameter, before each * element in the set of matched elements. */ public Jerry before(String html) { if (html == null) { html = StringPool.EMPTY; } final Document doc = builder.parse(html); if (nodes.length == 0) { return this; } for (Node node : nodes) { Document workingDoc = doc.clone(); node.insertBefore(workingDoc.getChildNodes(), node); } return this; }
/** * Inserts content, specified by the parameter, to the end of each * element in the set of matched elements. */ public Jerry append(String html) { if (html == null) { html = StringPool.EMPTY; } final Document doc = builder.parse(html); if (nodes.length == 0) { return this; } for (Node node : nodes) { Document workingDoc = doc.clone(); node.addChild(workingDoc.getChildNodes()); } return this; }
/** * Insert content, specified by the parameter, to the beginning of each * element in the set of matched elements. */ public Jerry prepend(String html) { if (html == null) { html = StringPool.EMPTY; } final Document doc = builder.parse(html); if (nodes.length == 0) { return this; } for (Node node : nodes) { Document workingDoc = doc.clone(); node.insertChild(workingDoc.getChildNodes(), 0); } return this; }
/** * Inserts content, specified by the parameter, after each * element in the set of matched elements. */ public Jerry after(String html) { if (html == null) { html = StringPool.EMPTY; } final Document doc = builder.parse(html); if (nodes.length == 0) { return this; } for (Node node : nodes) { Document workingDoc = doc.clone(); node.insertAfter(workingDoc.getChildNodes(), node); } return this; }
/** * Sets the HTML contents of each element in the set of matched elements. */ public Jerry html(String html) { final Document doc = builder.parse(html); for (Node node : nodes) { node.removeAllChilds(); Document workingDoc = doc.clone(); node.addChild(workingDoc.getChildNodes()); } return this; }
/** * Sets the HTML contents of each element in the set of matched elements. */ public Jerry html(String html) { final Document doc = builder.parse(html); for (Node node : nodes) { node.removeAllChilds(); // clone to preserve for next iteration // as nodes will be detached from parent Document workingDoc = doc.clone(); node.addChild(workingDoc.getChildNodes()); } return this; }
/** * Sets the HTML contents of each element in the set of matched elements. */ public Jerry html(String html) { if (html == null) { html = StringPool.EMPTY; } final Document doc = builder.parse(html); if (nodes.length == 0) { return this; } for (Node node : nodes) { node.removeAllChilds(); // clone to preserve for next iteration // as nodes will be detached from parent Document workingDoc = doc.clone(); node.addChild(workingDoc.getChildNodes()); } return this; }