/** * Tests whether this condition matches the given element. */ public boolean match(Element e, String pseudoE) { if (!(e instanceof CSSStylableElement)) return false; // Can't match an unstylable element. String attr = ((CSSStylableElement)e).getCSSClass(); String val = getValue(); int attrLen = attr.length(); int valLen = val.length(); int i = attr.indexOf(val); while (i != -1) { if (i == 0 || Character.isSpaceChar(attr.charAt(i - 1))) { if (i + valLen == attrLen || Character.isSpaceChar(attr.charAt(i + valLen))) { return true; } } i = attr.indexOf(val, i + valLen); } return false; }
/** * Tests whether this condition matches the given element. */ public boolean match(Element e, String pseudoE) { if (!(e instanceof CSSStylableElement)) return false; // Can't match an unstylable element. String attr = ((CSSStylableElement)e).getCSSClass(); String val = getValue(); int attrLen = attr.length(); int valLen = val.length(); int i = attr.indexOf(val); while (i != -1) { if (i == 0 || Character.isSpaceChar(attr.charAt(i - 1))) { if (i + valLen == attrLen || Character.isSpaceChar(attr.charAt(i + valLen))) { return true; } } i = attr.indexOf(val, i + valLen); } return false; }
/** * Tests whether this condition matches the given element. */ public boolean match(Element e, String pseudoE) { if (!(e instanceof CSSStylableElement)) return false; // Can't match an unstylable element. String attr = ((CSSStylableElement)e).getCSSClass(); String val = getValue(); int attrLen = attr.length(); int valLen = val.length(); int i = attr.indexOf(val); while (i != -1) { if (i == 0 || Character.isSpaceChar(attr.charAt(i - 1))) { if (i + valLen == attrLen || Character.isSpaceChar(attr.charAt(i + valLen))) { return true; } } i = attr.indexOf(val, i + valLen); } return false; }