/** * Removes all child nodes of the set of matched elements from the DOM. */ public Jerry empty() { if (nodes.length == 0) { return this; } for (Node node : nodes) { node.removeAllChilds(); } return this; }
/** * Sets the content of each element in the set of matched elements to the specified text. */ public Jerry text(String text) { if (nodes.length == 0) { return this; } if (text == null) { text = StringPool.EMPTY; } for (Node node : nodes) { node.removeAllChilds(); Text textNode = new Text(node.getOwnerDocument(), text); node.addChild(textNode); } 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; }
/** * Removes all child nodes of the set of matched elements from the DOM. */ public Jerry empty() { for (Node node : nodes) { node.removeAllChilds(); } return this; }
/** * Removes all child nodes of the set of matched elements from the DOM. */ public Jerry empty() { for (Node node : nodes) { node.removeAllChilds(); } return this; }
/** * Removes all child nodes of the set of matched elements from the DOM. */ public Jerry empty() { if (nodes.length == 0) { return this; } for (Node node : nodes) { node.removeAllChilds(); } return this; }
/** * Sets the content of each element in the set of matched elements to the specified text. */ public Jerry text(String text) { for (Node node : nodes) { node.removeAllChilds(); Text textNode = new Text(); textNode.setTextContent(text); node.addChild(textNode); } return this; }
/** * Sets the content of each element in the set of matched elements to the specified text. */ public Jerry text(String text) { for (Node node : nodes) { node.removeAllChilds(); Text textNode = new Text(node.getOwnerDocument(), text); node.addChild(textNode); } return this; }
/** * Sets the content of each element in the set of matched elements to the specified text. */ public Jerry text(String text) { if (nodes.length == 0) { return this; } if (text == null) { text = StringPool.EMPTY; } for (Node node : nodes) { node.removeAllChilds(); Text textNode = new Text(node.getOwnerDocument(), text); node.addChild(textNode); } 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; }