Make WordPress Core

Changeset 60633


Ignore:
Timestamp:
08/13/2025 05:56:35 PM (3 months ago)
Author:
dmsnell
Message:

HTML API: Make WP_HTML_Processor::serialize_token() public.

The serialize_token() method was added in WordPress 6.7.0 as a protected member on the WP_HTML_Processor class. It wasn’t clear at the time of merging if it would be necessary to expose it as a public method. However, since that time a number of experiments have led to the conclusion that it would be very valuable to do so.

This patch opens up the method for invocation from the outside, trivializing the generation of normative HTML subspans from a parent document.

Developed in https://github.com/WordPress/wordpress-develop/pull/9456
Discussed in https://core.trac.wordpress.org/ticket/63823

Follow-up to [59076].

Props dmsnell, jonsurrell.
Fixes #38044.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/html-api/class-wp-html-processor.php

    r60502 r60633  
    13051305     *
    13061306     * @since 6.7.0
     1307     * @since 6.9.0 Converted from protected to public method.
    13071308     *
    13081309     * @return string Serialization of token, or empty string if no serialization exists.
    13091310     */
    1310     protected function serialize_token(): string {
     1311    public function serialize_token(): string {
    13111312        $html       = '';
    13121313        $token_type = $this->get_token_type();
Note: See TracChangeset for help on using the changeset viewer.