Skip to content

Commit

Permalink
Uncomment stream block in Element
Browse files Browse the repository at this point in the history
  • Loading branch information
Isira-Seneviratne committed Jul 29, 2023
1 parent 1762412 commit 84787e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,14 @@
<version>2.3.3_r2</version>
</signature>
<ignores>
<ignore>java.util.Set</ignore>
<ignore>java.util.function.Consumer</ignore>
<ignore>java.util.function.Function</ignore>
<ignore>java.util.function.Supplier</ignore>
<ignore>java.lang.ThreadLocal</ignore>
<ignore>java.util.stream.Collector</ignore>
<ignore>java.util.stream.Collectors</ignore>
<ignore>java.util.stream.Stream</ignore>
</ignores>
<!-- ^ Provided by https://developer.android.com/studio/write/java8-support#library-desugaring
Possibly OK to remove androidscents; keep for now to validate other additions are supported. -->
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/org/jsoup/nodes/Element.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.jsoup.internal.StringUtil;
import org.jsoup.parser.ParseSettings;
import org.jsoup.parser.Tag;
import org.jsoup.parser.TokenQueue;
import org.jsoup.select.Collector;
import org.jsoup.select.Elements;
import org.jsoup.select.Evaluator;
Expand All @@ -30,6 +31,7 @@
import java.util.function.Consumer;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import java.util.stream.Collectors;

import static org.jsoup.internal.Normalizer.normalize;
import static org.jsoup.nodes.TextNode.lastCharIsWhitespace;
Expand Down Expand Up @@ -843,12 +845,9 @@ public String cssSelector() {
// Escape tagname, and translate HTML namespace ns:tag to CSS namespace syntax ns|tag
String tagName = escapeCssIdentifier(tagName()).replace("\\:", "|");
StringBuilder selector = StringUtil.borrowBuilder().append(tagName);
// String classes = StringUtil.join(classNames().stream().map(TokenQueue::escapeCssIdentifier).iterator(), ".");
// todo - replace with ^^ in 1.16.1 when we enable Android support for stream etc
StringUtil.StringJoiner escapedClasses = new StringUtil.StringJoiner(".");
for (String name : classNames()) escapedClasses.add(escapeCssIdentifier(name));
String classes = escapedClasses.complete();
if (classes.length() > 0)
String classes = classNames().stream().map(TokenQueue::escapeCssIdentifier)
.collect(Collectors.joining("."));
if (!classes.isEmpty())
selector.append('.').append(classes);

if (parent() == null || parent() instanceof Document) // don't add Document to selector, as will always have a html node
Expand Down

0 comments on commit 84787e2

Please sign in to comment.