Make WordPress Core


Ignore:
Timestamp:
01/24/2024 03:28:27 AM (9 months ago)
Author:
dmsnell
Message:

HTML API: Support INPUT tags.

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

  • INPUT

Previously this element was not supported and the HTML Processor would bail when encountering one. Now, with this patch applied, it will proceed to parse the HTML document.

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

Props jonsurrell
See #60283

File:
1 edited

Legend:

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

    r57326 r57343  
    102102 *  - Containers: ADDRESS, BLOCKQUOTE, DETAILS, DIALOG, DIV, FOOTER, HEADER, MAIN, MENU, SPAN, SUMMARY.
    103103 *  - Custom elements: All custom elements are supported. :)
    104  *  - Form elements: BUTTON, DATALIST, FIELDSET, LABEL, LEGEND, METER, PROGRESS, SEARCH.
     104 *  - Form elements: BUTTON, DATALIST, FIELDSET, INPUT, LABEL, LEGEND, METER, PROGRESS, SEARCH.
    105105 *  - Formatting elements: B, BIG, CODE, EM, FONT, I, PRE, SMALL, STRIKE, STRONG, TT, U, WBR.
    106106 *  - Heading elements: H1, H2, H3, H4, H5, H6, HGROUP.
    107107 *  - Links: A.
    108  *  - Lists: DD, DL, DT, LI, OL, LI.
    109  *  - Media elements: AUDIO, CANVAS, EMBED, FIGCAPTION, FIGURE, IMG, MAP, PARAM, PICTURE, SOURCE, VIDEO, TRACK.
     108 *  - Lists: DD, DL, DT, LI, OL, UL.
     109 *  - Media elements: AUDIO, CANVAS, EMBED, FIGCAPTION, FIGURE, IMG, MAP, PICTURE, SOURCE, TRACK, VIDEO.
    110110 *  - Paragraph: BR, P.
    111  *  - Phrasing elements: AREA, ABBR, BDI, BDO, CITE, DATA, DEL, DFN, INS, MARK, OUTPUT, Q, SAMP, SUB, SUP, TIME, VAR.
     111 *  - Phrasing elements: ABBR, AREA, BDI, BDO, CITE, DATA, DEL, DFN, INS, MARK, OUTPUT, Q, SAMP, SUB, SUP, TIME, VAR.
    112112 *  - Sectioning elements: ARTICLE, ASIDE, HR, NAV, SECTION.
    113113 *  - Templating elements: SLOT.
    114114 *  - Text decoration: RUBY.
    115  *  - Deprecated elements: ACRONYM, BLINK, CENTER, DIR, ISINDEX, KEYGEN, LISTING, MULTICOL, NEXTID, SPACER.
     115 *  - Deprecated elements: ACRONYM, BLINK, CENTER, DIR, ISINDEX, KEYGEN, LISTING, MULTICOL, NEXTID, PARAM, SPACER.
    116116 *
    117117 * ### Supported markup
     
    974974
    975975            /*
     976             * > A start tag whose tag name is "input"
     977             */
     978            case '+INPUT':
     979                $this->reconstruct_active_formatting_elements();
     980                $this->insert_html_element( $this->state->current_token );
     981                $type_attribute = $this->get_attribute( 'type' );
     982                /*
     983                 * > If the token does not have an attribute with the name "type", or if it does,
     984                 * > but that attribute's value is not an ASCII case-insensitive match for the
     985                 * > string "hidden", then: set the frameset-ok flag to "not ok".
     986                 */
     987                if ( ! is_string( $type_attribute ) || 'hidden' !== strtolower( $type_attribute ) ) {
     988                    $this->state->frameset_ok = false;
     989                }
     990                return true;
     991
     992            /*
    976993             * > A start tag whose tag name is "hr"
    977994             */
     
    10251042            case 'HTML':
    10261043            case 'IFRAME':
    1027             case 'INPUT':
    10281044            case 'LINK':
    10291045            case 'MARQUEE':
Note: See TracChangeset for help on using the changeset viewer.