Selector { public static Elements select(String query, Element root) { return new Selector(query, root).select(); } private  Selector(String query, Element root); static Elements select(String query, Element root); static Elements select(String query, Iterable<Element> roots);  }
@Test public void handlesCommasInSelector() { Document doc = Jsoup.parse("<p name='1,2'>One</p><div>Two</div><ol><li>123</li><li>Text</li></ol>"); Elements ps = doc.select("[name=1,2]"); assertEquals(1, ps.size()); Elements containers = doc.select("div, li:matches([0-9,]+)"); assertEquals(2, containers.size()); assertEquals("div", containers.get(0).tagName()); assertEquals("li", containers.get(1).tagName()); assertEquals("123", containers.get(1).text()); }
@Test public void selectSupplementaryCharacter() { String s = new String(Character.toChars(135361)); Document doc = Jsoup.parse("<div k" + s + "='" + s + "'>^" + s +"$/div>"); assertEquals("div", doc.select("div[k" + s + "]").first().tagName()); assertEquals("div", doc.select("div:containsOwn(" + s + ")").first().tagName()); }