Repository: jhy/jsoup
Pull request #2170 (2024-07-15 23:26:52)

Bump org.apache.maven.plugins:maven-failsafe-plugin from 3.3.0 to 3.3.1
Bumps [org.apache.maven.plugins:maven-failsafe-plugin](https://github.com/apache/maven-surefire) from 3.3.0 to 3.3.1.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/apache/maven-surefire/commit/7e4562036f88ba082ea5a58008d799e354e4fc1e"><code>7e45620</code></a> [maven-release-plugin] prepare release surefire-3.3.1</li>
<li><a href="https://github.com/apache/maven-surefire/commit/561b4ca356e6fae53f0f16f4862fdd22305852fb"><code>561b4ca</code></a> [SUREFIRE-2250] Surefire Test Report Schema properties element is not consist...</li>
<li><a href="https://github.com/apache/maven-surefire/commit/6aaea8a6dfed1f8f5b803dc202fefa5a47f14bb7"><code>6aaea8a</code></a> [SUREFIRE-1360] Ability to disable properties for successfully passed tests</li>
<li><a href="https://github.com/apache/maven-surefire/commit/c17b92bf79d33b34bf5c6e3bab1128e8ee1c8f01"><code>c17b92b</code></a> Bump org.codehaus.mojo:animal-sniffer-maven-plugin from 1.23 to 1.24</li>
<li><a href="https://github.com/apache/maven-surefire/commit/748d9dcbf43eaf91dace4009d1aa2cc669953c91"><code>748d9dc</code></a> Fix typos</li>
<li><a href="https://github.com/apache/maven-surefire/commit/f8092e99c0d3e4439e8e74ffd1df49f256373a35"><code>f8092e9</code></a> Improve time units</li>
<li><a href="https://github.com/apache/maven-surefire/commit/c670335783cfcb43cfba7042b90748708eb299ce"><code>c670335</code></a> [SUREFIRE-1934] Ability to disable system-out/system-err for successfully pas...</li>
<li><a href="https://github.com/apache/maven-surefire/commit/bce1b39b042f8cd696c2bc9b9205303aff6409ae"><code>bce1b39</code></a> Improve docs of linkXRef</li>
<li><a href="https://github.com/apache/maven-surefire/commit/3c49ebdd6a2df6da992d8b2b6b7e7843e948fb21"><code>3c49ebd</code></a> Bump org.htmlunit:htmlunit from 4.2.0 to 4.3.0</li>
<li><a href="https://github.com/apache/maven-surefire/commit/6ff0f83ea1c9427a88d42b3a8c1b7bdb9e5e3fcb"><code>6ff0f83</code></a> [SUREFIRE-2242] Plain test report does not include names of the skipped tests</li>
<li>Additional commits viewable in <a href="https://github.com/apache/maven-surefire/compare/surefire-3.3.0...surefire-3.3.1">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.apache.maven.plugins:maven-failsafe-plugin&package-manager=maven&previous-version=3.3.0&new-version=3.3.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/CHANGES.md b/CHANGES.md
index 2a1765ba..2995fe15 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -6,6 +6,11 @@
 * The form associated elements returned by `FormElement.elements()` now reflect changes made to the DOM, 
   subsequently to the original parse. [2140](https://github.com/jhy/jsoup/issues/2140)
 
+### Bug Fixes
+
+* `Element.cssSelector()` would fail if the element's class contained a `*`
+  character. [2169](https://github.com/jhy/jsoup/issues/2169)
+
 ## 1.18.1 (2024-Jul-10)
 
 ### Improvements
diff --git a/pom.xml b/pom.xml
index 9e4cca3b..fe990de3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -210,7 +210,7 @@
       </plugin>
       <plugin>
         <artifactId>maven-failsafe-plugin</artifactId>
-        <version>3.3.0</version>
+        <version>3.3.1</version>
         <executions>
           <execution>
             <goals>
@@ -371,7 +371,7 @@
         <plugins>
           <plugin>
             <artifactId>maven-failsafe-plugin</artifactId>
-            <version>3.3.0</version>
+            <version>3.3.1</version>
             <executions>
               <execution>
                 <goals>
diff --git a/src/main/java/org/jsoup/parser/TokenQueue.java b/src/main/java/org/jsoup/parser/TokenQueue.java
index c7e7f9e9..3ef301be 100644
--- a/src/main/java/org/jsoup/parser/TokenQueue.java
+++ b/src/main/java/org/jsoup/parser/TokenQueue.java
@@ -302,7 +302,7 @@ public class TokenQueue {
         StringBuilder out = StringUtil.borrowBuilder();
         TokenQueue q = new TokenQueue(in);
         while (!q.isEmpty()) {
-            if (q.matchesCssIdentifier(ElementSelectorChars)) {
+            if (q.matchesCssIdentifier(CssIdentifierChars)) {
                 out.append(q.consume());
             } else {
                 out.append(ESC).append(q.consume());


Test patch:
diff --git a/src/test/java/org/jsoup/nodes/ElementTest.java b/src/test/java/org/jsoup/nodes/ElementTest.java
index ef0b2254..de35495f 100644
--- a/src/test/java/org/jsoup/nodes/ElementTest.java
+++ b/src/test/java/org/jsoup/nodes/ElementTest.java
@@ -2636,6 +2636,18 @@ public class ElementTest {
         assertEquals(selected.first(), div);
     }
 
+    @Test void cssSelectorWithAstrix() {
+        // https://github.com/jhy/jsoup/issues/2169
+        Document doc = Jsoup.parse("<div class='vds-items_flex-end [&amp;_>_*:first-child]:vds-pt_0'>One</div><div class='vds-items_flex-end'>Two</div>");
+        Element div = doc.expectFirst("div");
+        String selector = div.cssSelector();
+        assertEquals("html > body > div.vds-items_flex-end.\\[\\&_\\>_\\*\\:first-child\\]\\:vds-pt_0", selector);
+
+        Elements selected = doc.select(selector);
+        assertEquals(1, selected.size());
+        assertEquals(selected.first(), div);
+    }
+
     @Test void orphanSiblings() {
         Element el = new Element("div");
         assertEquals(0, el.siblingElements().size());