Make WordPress Core

Changeset 63463


Ignore:
Timestamp:
09/04/2026 09:46:09 AM (13 hours ago)
Author:
zieladam
Message:

HTML API: Simplify interactive class_list() examples.

Removes the PHP opening tag and manual WordPress bootstrap now that WordPress Playground and the Code Reference load WordPress before running interactive examples. Prints each class name directly and places the expected output in a trailing comment.

Developed in https://github.com/WordPress/wordpress-develop/pull/13267.

Follow-up to r63293.

Props jonsurrell, dmsnell.
See #65860.

Location:
trunk/src/wp-includes/html-api
Files:
2 edited

Legend:

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

    r63320 r63463  
    54325432         *
    54335433         * ```php interactive
    5434          * <?php
    5435          * require '/wordpress/wp-load.php';
    54365434         * $p = WP_HTML_Processor::create_fragment( "<div class='free &lt;egg&gt;\tlang-en'>" );
    54375435         * $p->next_tag();
    54385436         * foreach ( $p->class_list() as $class_name ) {
    5439          *   var_dump( $class_name );
     5437         *   echo "{$class_name} ";
    54405438         * }
    5441          * ```
    5442          * ```expected-output
    5443          * string(4) "free"
    5444          * string(5) "<egg>"
    5445          * string(7) "lang-en"
     5439         * // Outputs: "free <egg> lang-en "
    54465440         * ```
    54475441         *
  • trunk/src/wp-includes/html-api/class-wp-html-tag-processor.php

    r63418 r63463  
    11801180         *
    11811181         * ```php interactive
    1182          * <?php
    1183          * require '/wordpress/wp-load.php';
    11841182         * $p = new WP_HTML_Tag_Processor( "<div class='free &lt;egg&gt;\tlang-en'>" );
    11851183         * $p->next_tag();
    11861184         * foreach ( $p->class_list() as $class_name ) {
    1187          *   var_dump( $class_name );
     1185         *   echo "{$class_name} ";
    11881186         * }
    1189          * ```
    1190          * ```expected-output
    1191          * string(4) "free"
    1192          * string(5) "<egg>"
    1193          * string(7) "lang-en"
     1187         * // Outputs: "free <egg> lang-en "
    11941188         * ```
    11951189         *
Note: See TracChangeset for help on using the changeset viewer.