Repository: jhy/jsoup
Pull request #2172 (2024-07-15 23:27:01)

Bump org.apache.maven.plugins:maven-release-plugin from 3.1.0 to 3.1.1
Bumps [org.apache.maven.plugins:maven-release-plugin](https://github.com/apache/maven-release) from 3.1.0 to 3.1.1.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/apache/maven-release/commit/4f350d44478d2bf72a8da60395e0c1d1e045369a"><code>4f350d4</code></a> [maven-release-plugin] prepare release maven-release-3.1.1</li>
<li><a href="https://github.com/apache/maven-release/commit/06f6de43312ee6cab4ec1a194781a61c5db5bdf9"><code>06f6de4</code></a> [MRELEASE-1153] Revert parts of MRELEASE-1109 (8dfcb47996320af5e6f0b2d50eac20...</li>
<li><a href="https://github.com/apache/maven-release/commit/985d0bcd3f9bd28fc8e78e9c0744abe66aeea7ef"><code>985d0bc</code></a> [MRELEASE-1149] Current release of the plugin has configuration docs missing</li>
<li><a href="https://github.com/apache/maven-release/commit/47e94b43951778aa9cca7ebd960aa114efa9931a"><code>47e94b4</code></a> [maven-release-plugin] prepare for next development iteration</li>
<li>See full diff in <a href="https://github.com/apache/maven-release/compare/maven-release-3.1.0...maven-release-3.1.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-release-plugin&package-manager=maven&previous-version=3.1.0&new-version=3.1.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..7d88aac8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -197,12 +197,12 @@
       </plugin>
       <plugin>
         <artifactId>maven-release-plugin</artifactId>
-        <version>3.1.0</version>
+        <version>3.1.1</version>
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
-        <version>3.3.0</version>
+        <version>3.3.1</version>
         <configuration>
           <!-- smaller stack to find stack overflows. Was 256, but Zulu on MacOS ARM needs >= 640 -->
           <argLine>-Xss640k</argLine>
@@ -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());