private static void deleteAfter(final DomNode node, final int offset) { if (isOffsetChars(node)) { String text = getText(node); if (offset > -1 && offset < text.length()) { text = text.substring(0, offset); setText(node, text); } } else { final DomNodeList<DomNode> children = node.getChildNodes(); for (int i = offset; i < children.getLength(); i++) { final DomNode child = children.get(i); child.remove(); i--; } } }
private static void deleteAfter(final DomNode node, final int offset) { if (isOffsetChars(node)) { String text = getText(node); if (offset > -1 && offset < text.length()) { text = text.substring(0, offset); setText(node, text); } } else { final DomNodeList<DomNode> children = node.getChildNodes(); for (int i = offset; i < children.getLength(); i++) { final DomNode child = children.get(i); child.remove(); i--; } } }
private static void deleteBefore(final DomNode node, int offset) { if (isOffsetChars(node)) { String text = getText(node); if (offset > -1 && offset < text.length()) { text = text.substring(offset); } else { text = ""; } setText(node, text); } else { final DomNodeList<DomNode> children = node.getChildNodes(); for (int i = 0; i < offset && i < children.getLength(); i++) { final DomNode child = children.get(i); child.remove(); i--; offset--; } } }
private static void deleteBefore(final DomNode node, int offset) { if (isOffsetChars(node)) { String text = getText(node); if (offset > -1 && offset < text.length()) { text = text.substring(offset); } else { text = ""; } setText(node, text); } else { final DomNodeList<DomNode> children = node.getChildNodes(); for (int i = 0; i < offset && i < children.getLength(); i++) { final DomNode child = children.get(i); child.remove(); i--; offset--; } } }
return !selects(nc.getCondition(), element); case Condition.SAC_ONLY_CHILD_CONDITION: return element.getParentNode().getChildNodes().getLength() == 1; case Condition.SAC_CONTENT_CONDITION: final ContentCondition cc = (ContentCondition) condition; case Condition.SAC_ONLY_TYPE_CONDITION: final String tagName = element.getTagName(); return ((HtmlPage) element.getPage()).getElementsByTagName(tagName).getLength() == 1; case Condition.SAC_POSITIONAL_CONDITION: case Condition.SAC_PSEUDO_CLASS_CONDITION:
return !selects(nc.getCondition(), element); case Condition.SAC_ONLY_CHILD_CONDITION: return element.getParentNode().getChildNodes().getLength() == 1; case Condition.SAC_CONTENT_CONDITION: final ContentCondition cc = (ContentCondition) condition; case Condition.SAC_ONLY_TYPE_CONDITION: final String tagName = element.getTagName(); return ((HtmlPage) element.getPage()).getElementsByTagName(tagName).getLength() == 1; case Condition.SAC_POSITIONAL_CONDITION: case Condition.SAC_PSEUDO_CLASS_CONDITION:
return !selects(nc.getCondition(), element); case Condition.SAC_ONLY_CHILD_CONDITION: return element.getParentNode().getChildNodes().getLength() == 1; case Condition.SAC_CONTENT_CONDITION: final ContentCondition cc = (ContentCondition) condition; case Condition.SAC_ONLY_TYPE_CONDITION: final String tagName = element.getTagName(); return ((HtmlPage) element.getPage()).getElementsByTagName(tagName).getLength() == 1; case Condition.SAC_POSITIONAL_CONDITION: case Condition.SAC_PSEUDO_CLASS_CONDITION: