Make WordPress Core


Ignore:
Timestamp:
08/08/2024 07:23:53 AM (15 months ago)
Author:
dmsnell
Message:

HTML API: Add support for SVG and MathML (Foreign content)

As part of work to add more spec support to the HTML API, this patch adds
support for SVG and MathML elements, or more generally, "foreign content."

The rules in foreign content are a mix of XML and HTML parsing rules and
introduce additional complexity into the processor, but is important in
order to avoid getting lost when inside these elements.

Developed in https://github.com/wordpress/wordpress-develop/pull/6006
Discussed in https://core.trac.wordpress.org/ticket/61576

Props: dmsnell, jonsurrell, westonruter.
See #61576.

File:
1 edited

Legend:

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

    r58779 r58867  
    6262
    6363    /**
     64     * Indicates if the element is an HTML element or if it's inside foreign content.
     65     *
     66     * @since 6.7.0
     67     *
     68     * @var string 'html', 'svg', or 'math'.
     69     */
     70    public $namespace = 'html';
     71
     72    /**
     73     * Indicates which kind of integration point the element is, if any.
     74     *
     75     * @since 6.7.0
     76     *
     77     * @var string|null 'math', 'html', or null if not an integration point.
     78     */
     79    public $integration_node_type = null;
     80
     81    /**
    6482     * Called when token is garbage-collected or otherwise destroyed.
    6583     *
     
    8199    public function __construct( ?string $bookmark_name, string $node_name, bool $has_self_closing_flag, ?callable $on_destroy = null ) {
    82100        $this->bookmark_name         = $bookmark_name;
     101        $this->namespace             = 'html';
    83102        $this->node_name             = $node_name;
    84103        $this->has_self_closing_flag = $has_self_closing_flag;
Note: See TracChangeset for help on using the changeset viewer.