Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added RootSelector support

  • Loading branch information...
commit 03abecc026164842ea91810278b2ebecf7fc6be3 1 parent 3f91b30
@kzn kzn authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/main/java/org/jsoup/select/ng/parser/Parser.java
View
6 src/main/java/org/jsoup/select/ng/parser/Parser.java
@@ -20,6 +20,7 @@
import org.jsoup.select.ng.ParentSelector;
import org.jsoup.select.ng.PrevSiblingSelector;
import org.jsoup.select.ng.PreviousSequentSiblingSelector;
+import org.jsoup.select.ng.RootSelector;
import org.jsoup.select.ng.SelectMatch;
public class Parser {
@@ -46,6 +47,7 @@ public Evaluator parse() {
if (tq.matchesAny(combinators)) { // if starts with a combinator, use root as elements
//elements.add(root);
+ s.add(new RootSelector());
combinator(tq.consume());
} else if (tq.matches(":has(")) {
//elements.addAll(root.getAllElements());
@@ -156,7 +158,7 @@ private void byId() {
private void byClass() {
String className = tq.consumeCssIdentifier();
Validate.notEmpty(className);
- ecPush(new Evaluator.Class(className));
+ ecPush(new Evaluator.Class(className.trim().toLowerCase()));
}
private void byTag() {
@@ -167,7 +169,7 @@ private void byTag() {
if (tagName.contains("|"))
tagName = tagName.replace("|", ":");
- ecPush(new Evaluator.Tag(tagName));
+ ecPush(new Evaluator.Tag(tagName.trim().toLowerCase()));
}
private void byAttribute() {
Please sign in to comment.
Something went wrong with that request. Please try again.