Make WordPress Core


Ignore:
Timestamp:
07/03/2024 05:05:46 PM (12 months ago)
Author:
dmsnell
Message:

HTML API: Implement the _reset insertion mode appropriately_ algorithm.

In order to add support for the SELECT and TABLE tags in the HTML Processor, it
needs to implement the HTML algorithm named "reset the insertion mode
appropriately".

This patch implements that algorithm to unblock the additional tag support. The
algorithm resets the parsing mode after specific state changes in complicated
situations where alternative rules are in effect (such as rules governing how
the parser handles tags found within a TABLE element).

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

Props dmsnell, jonsurrell.
Fixes #61549.

File:
1 edited

Legend:

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

    r58631 r58656  
    217217
    218218    /**
     219     * The stack of template insertion modes.
     220     *
     221     * @since 6.7.0
     222     *
     223     * @see https://html.spec.whatwg.org/#the-insertion-mode:stack-of-template-insertion-modes
     224     *
     225     * @var array<string>
     226     */
     227    public $stack_of_template_insertion_modes = array();
     228
     229    /**
    219230     * Tracks open elements while scanning HTML.
    220231     *
     
    272283     */
    273284    public $context_node = null;
     285
     286    /**
     287     * HEAD element pointer.
     288     *
     289     * @since 6.7.0
     290     *
     291     * @see https://html.spec.whatwg.org/multipage/parsing.html#head-element-pointer
     292     *
     293     * @var WP_HTML_Token|null
     294     */
     295    public $head_element = null;
    274296
    275297    /**
Note: See TracChangeset for help on using the changeset viewer.