diff --git a/src/wp-includes/html-api/class-wp-css-selectors.php b/src/wp-includes/html-api/class-wp-css-selectors.php
index 8af33c2194723..8b92150cbef8f 100644
--- a/src/wp-includes/html-api/class-wp-css-selectors.php
+++ b/src/wp-includes/html-api/class-wp-css-selectors.php
@@ -707,6 +707,10 @@ public function matches( WP_HTML_Processor $processor ): bool {
return true;
}
+ if ( true === $att_value ) {
+ $att_value = '';
+ }
+
$case_insensitive = self::MODIFIER_CASE_INSENSITIVE === $this->modifier;
switch ( $this->matcher ) {