Skip to content
Closed
Prev Previous commit
Next Next commit
Update comment about attribute value escaping
  • Loading branch information
sirreal committed Oct 8, 2025
commit b581113d08805a8924b9d7dd82d9fce053161a03
3 changes: 2 additions & 1 deletion src/wp-includes/html-api/class-wp-html-tag-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -3884,7 +3884,8 @@ static function ( $tag_match ) {
* - When `true` is passed as the value, then only the attribute name is added to the tag.
* - When `false` is passed, the attribute gets removed if it existed before.
*
* For string attributes, the value is escaped using the `esc_attr` function.
* HTML escaping will be performed for string attribute values. The input value should
* not be unescaped.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have a confusing double-negative here.
can we rearrange this so it’s a positive indication of what to do, rather than a negative impression of what not to do?

 * This function handles all HTML escaping: send normal and unescaped string values.
 * The HTML API will convey input strings such that a browser will read the decoded
 * string values as verbatim copies to what is provided here.
 *
 * Example:
 *
 *     // Renders “Eggs & Milk” in a browser, encoded as “Eggs & Milk”.
 *     $processor->set_attribute( 'title', 'Eggs & Milk' );
 *
 *     // Renders “Eggs & Milk” in a browser, encoded as “Eggs & Milk”.
 *     $processor->set_attribute( 'title', 'Eggs & Milk' );

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, updated the description in 0db1374, happy to make further adjustments.

*
* @since 6.2.0
* @since 6.2.1 Fix: Only create a single update for multiple calls with case-variant attribute names.
Expand Down
Loading