Make WordPress Core

Changeset 57326


Ignore:
Timestamp:
01/23/2024 01:49:06 AM (4 months ago)
Author:
dmsnell
Message:

HTML API: Support PARAM, SOURCE, and TRACK tags.

Adds support for the following HTML elements to the HTML Processor:

  • PARAM, SOURCE, TRACK

Previously these elements were not supported and the HTML Processor would bail when encountering them. Now, with this patch applied, it will proceed to parse an HTML document when encountering those tags.

Props jonsurrell, dmsnell
Fixes #60283

Location:
trunk
Files:
3 edited

Legend:

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

    r57319 r57326  
    107107 *  - Links: A.
    108108 *  - Lists: DD, DL, DT, LI, OL, LI.
    109  *  - Media elements: AUDIO, CANVAS, EMBED, FIGCAPTION, FIGURE, IMG, MAP, PICTURE, VIDEO.
     109 *  - Media elements: AUDIO, CANVAS, EMBED, FIGCAPTION, FIGURE, IMG, MAP, PARAM, PICTURE, SOURCE, VIDEO, TRACK.
    110110 *  - Paragraph: BR, P.
    111111 *  - Phrasing elements: AREA, ABBR, BDI, BDO, CITE, DATA, DEL, DFN, INS, MARK, OUTPUT, Q, SAMP, SUB, SUP, TIME, VAR.
     
    982982                $this->insert_html_element( $this->state->current_token );
    983983                $this->state->frameset_ok = false;
     984                return true;
     985
     986            /*
     987             * > A start tag whose tag name is one of: "param", "source", "track"
     988             */
     989            case '+PARAM':
     990            case '+SOURCE':
     991            case '+TRACK':
     992                $this->insert_html_element( $this->state->current_token );
    984993                return true;
    985994        }
     
    10281037            case 'OPTGROUP':
    10291038            case 'OPTION':
    1030             case 'PARAM':
    10311039            case 'PLAINTEXT':
    10321040            case 'RB':
     
    10371045            case 'SCRIPT':
    10381046            case 'SELECT':
    1039             case 'SOURCE':
    10401047            case 'STYLE':
    10411048            case 'SVG':
     
    10501057            case 'TITLE':
    10511058            case 'TR':
    1052             case 'TRACK':
    10531059            case 'XMP':
    10541060                $this->last_error = self::ERROR_UNSUPPORTED;
     
    17131719            'IMG' === $tag_name ||
    17141720            'INPUT' === $tag_name ||
     1721            'KEYGEN' === $tag_name || // Obsolete but still treated as void.
    17151722            'LINK' === $tag_name ||
    1716             'KEYGEN' === $tag_name || // Obsolete but still treated as void.
    17171723            'META' === $tag_name ||
    17181724            'PARAM' === $tag_name || // Obsolete but still treated as void.
  • trunk/tests/phpunit/tests/html-api/wpHtmlProcessor.php

    r57317 r57326  
    207207            'LINK'   => array( 'LINK' ),
    208208            'META'   => array( 'META' ),
     209            'PARAM'  => array( 'PARAM' ),
    209210            'SOURCE' => array( 'SOURCE' ),
    210211            'TRACK'  => array( 'TRACK' ),
     
    265266            'OPTGROUP'  => array( 'OPTGROUP' ),
    266267            'OPTION'    => array( 'OPTION' ),
    267             'PARAM'     => array( 'PARAM' ),
    268268            'PLAINTEXT' => array( 'PLAINTEXT' ),
    269269            'RB'        => array( 'RB' ),
     
    274274            'SCRIPT'    => array( 'SCRIPT' ),
    275275            'SELECT'    => array( 'SELECT' ),
    276             'SOURCE'    => array( 'SOURCE' ),
    277276            'STYLE'     => array( 'STYLE' ),
    278277            'SVG'       => array( 'SVG' ),
     
    287286            'TITLE'     => array( 'TITLE' ),
    288287            'TR'        => array( 'TR' ),
    289             'TRACK'     => array( 'TRACK' ),
    290288            'XMP'       => array( 'XMP' ),
    291289        );
  • trunk/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php

    r57319 r57326  
    200200            'SCRIPT',
    201201            'SELECT',
    202             'SOURCE',
    203202            'STYLE',
    204203            'SVG',
     
    213212            'TITLE',
    214213            'TR',
    215             'TRACK',
    216214            'XMP', // Deprecated, use PRE instead.
    217215        );
Note: See TracChangeset for help on using the changeset viewer.