@Test public void parents() { Document doc = Jsoup.parse("<div><p>Hello</p></div><p>There</p>"); Elements parents = doc.select("p").parents(); assertEquals(3, parents.size()); assertEquals("div", parents.get(0).tagName()); assertEquals("body", parents.get(1).tagName()); assertEquals("html", parents.get(2).tagName()); }
public Elements parents() { Set<Element> combo = new LinkedHashSet<Element>(); for (Element e: this) { combo.addAll(e.parents()); } return new Elements(combo); }
Elements extends ArrayList<Element> { public Elements parents() { Set<Element> combo = new LinkedHashSet<Element>(); for (Element e: this) { combo.addAll(e.parents()); } return new Elements(combo); } }
Elements extends ArrayList<Element> { public Elements parents() { Set<Element> combo = new LinkedHashSet<Element>(); for (Element e: this) { combo.addAll(e.parents()); } return new Elements(combo); } Elements();  Elements(int initialCapacity);  Elements(Collection<Element> elements);  Elements(List<Element> elements);  Elements(Element... elements); }
Elements extends ArrayList<Element> { public Elements parents() { Set<Element> combo = new LinkedHashSet<Element>(); for (Element e: this) { combo.addAll(e.parents()); } return new Elements(combo); } Elements();  Elements(int initialCapacity);  Elements(Collection<Element> elements);  Elements(List<Element> elements);  Elements(Element... elements); @Override Object clone(); String attr(String attributeKey); boolean hasAttr(String attributeKey); Elements attr(String attributeKey, String attributeValue); Elements removeAttr(String attributeKey); Elements addClass(String className); Elements removeClass(String className); Elements toggleClass(String className); boolean hasClass(String className); String val(); Elements val(String value); String text(); boolean hasText(); String html(); String outerHtml(); @Override String toString(); Elements tagName(String tagName); Elements html(String html); Elements prepend(String html); Elements append(String html); Elements before(String html); Elements after(String html); Elements wrap(String html); Elements unwrap(); Elements empty(); Elements remove(); Elements select(String query); Elements not(String query); Elements eq(int index); boolean is(String query); Elements parents(); Element first(); Element last(); Elements traverse(NodeVisitor nodeVisitor); List<FormElement> forms(); }
Elements extends ArrayList<Element> { public Elements parents() { Set<Element> combo = new LinkedHashSet<Element>(); for (Element e: this) { combo.addAll(e.parents()); } return new Elements(combo); } Elements();  Elements(int initialCapacity);  Elements(Collection<Element> elements);  Elements(List<Element> elements);  Elements(Element... elements); @Override Object clone(); String attr(String attributeKey); boolean hasAttr(String attributeKey); Elements attr(String attributeKey, String attributeValue); Elements removeAttr(String attributeKey); Elements addClass(String className); Elements removeClass(String className); Elements toggleClass(String className); boolean hasClass(String className); String val(); Elements val(String value); String text(); boolean hasText(); String html(); String outerHtml(); @Override String toString(); Elements tagName(String tagName); Elements html(String html); Elements prepend(String html); Elements append(String html); Elements before(String html); Elements after(String html); Elements wrap(String html); Elements unwrap(); Elements empty(); Elements remove(); Elements select(String query); Elements not(String query); Elements eq(int index); boolean is(String query); Elements parents(); Element first(); Element last(); Elements traverse(NodeVisitor nodeVisitor); List<FormElement> forms();  }