Make WordPress Core

Changeset 57248


Ignore:
Timestamp:
01/08/2024 02:03:40 PM (3 years ago)
Author:
Bernhard Reiter
Message:

HTML API: Add explicit handling or failure for all tags.

The HTML API HTML processor does not yet support all tags. Many tags (e.g. list elements) have some complicated rules in the "in body" insertion mode.

Implementing these special rules is blocking the implementation for a catch-all rule for "any other tag" because we need to prevent special rules from being handled by the catch-all.

Any other start tag
Reconstruct the active formatting elements, if any.

Insert an HTML element for the token.


This change ensures the HTML Processor fails when handling special tags. This is the same as existing behavior, but will allow us to implement the catch-all "any other tag" handling without unintentionally handling special elements.

Additionally, we add tests that assert the special elements are unhandled. As these tags are implemented, this should help to ensure they're removed from the unsupported tag list.

Props jonsurrell, dmsnell.
Fixes #60092.

Location:
trunk
Files:
4 edited

Legend:

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

    r57209 r57248  
    101101 *
    102102 *  - Containers: ADDRESS, BLOCKQUOTE, DETAILS, DIALOG, DIV, FOOTER, HEADER, MAIN, MENU, SPAN, SUMMARY.
    103  *  - Form elements: BUTTON, FIELDSET, SEARCH.
     103 *  - Custom elements: All custom elements are supported. :)
     104 *  - Form elements: BUTTON, DATALIST, FIELDSET, LABEL, LEGEND, METER, PROGRESS, SEARCH.
    104105 *  - Formatting elements: B, BIG, CODE, EM, FONT, I, SMALL, STRIKE, STRONG, TT, U.
    105106 *  - Heading elements: H1, H2, H3, H4, H5, H6, HGROUP.
    106107 *  - Links: A.
    107108 *  - Lists: DL.
    108  *  - Media elements: FIGCAPTION, FIGURE, IMG.
     109 *  - Media elements: AUDIO, CANVAS, FIGCAPTION, FIGURE, IMG, MAP, PICTURE, VIDEO.
    109110 *  - Paragraph: P.
    110  *  - Sectioning elements: ARTICLE, ASIDE, NAV, SECTION
    111  *  - Deprecated elements: CENTER, DIR
     111 *  - Phrasing elements: ABBR, BDI, BDO, CITE, DATA, DEL, DFN, INS, MARK, OUTPUT, Q, SAMP, SUB, SUP, TIME, VAR.
     112 *  - Sectioning elements: ARTICLE, ASIDE, NAV, SECTION.
     113 *  - Templating elements: SLOT.
     114 *  - Text decoration: RUBY.
     115 *  - Deprecated elements: ACRONYM, BLINK, CENTER, DIR, ISINDEX, MULTICOL, NEXTID, SPACER.
    112116 *
    113117 * ### Supported markup
     
    831835                                $this->insert_html_element( $this->state->current_token );
    832836                                return true;
    833 
    834                         /*
    835                          * > Any other start tag
    836                          */
    837                         case '+SPAN':
    838                                 $this->reconstruct_active_formatting_elements();
    839                                 $this->insert_html_element( $this->state->current_token );
    840                                 return true;
    841 
    842                         /*
    843                          * Any other end tag
    844                          */
    845                         case '-SPAN':
    846                                 foreach ( $this->state->stack_of_open_elements->walk_up() as $item ) {
    847                                         // > If node is an HTML element with the same tag name as the token, then:
    848                                         if ( $item->node_name === $tag_name ) {
    849                                                 $this->generate_implied_end_tags( $tag_name );
    850 
    851                                                 // > If node is not the current node, then this is a parse error.
    852 
    853                                                 $this->state->stack_of_open_elements->pop_until( $tag_name );
    854                                                 return true;
    855                                         }
    856 
    857                                         // > Otherwise, if node is in the special category, then this is a parse error; ignore the token, and return.
    858                                         if ( self::is_special( $item->node_name ) ) {
    859                                                 return $this->step();
    860                                         }
    861                                 }
    862                                 // Execution should not reach here; if it does then something went wrong.
    863                                 return false;
    864 
    865                         default:
     837                }
     838
     839                /*
     840                 * These tags require special handling in the 'in body' insertion mode
     841                 * but that handling hasn't yet been implemented.
     842                 *
     843                 * As the rules for each tag are implemented, the corresponding tag
     844                 * name should be removed from this list. An accompanying test should
     845                 * help ensure this list is maintained.
     846                 *
     847                 * @see Tests_HtmlApi_WpHtmlProcessor::test_step_in_body_fails_on_unsupported_tags
     848                 *
     849                 * Since this switch structure throws a WP_HTML_Unsupported_Exception, it's
     850                 * possible to handle "any other start tag" and "any other end tag" below,
     851                 * as that guarantees execution doesn't proceed for the unimplemented tags.
     852                 *
     853                 * @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inbody
     854                 */
     855                switch ( $tag_name ) {
     856                        case 'APPLET':
     857                        case 'AREA':
     858                        case 'BASE':
     859                        case 'BASEFONT':
     860                        case 'BGSOUND':
     861                        case 'BODY':
     862                        case 'BR':
     863                        case 'CAPTION':
     864                        case 'COL':
     865                        case 'COLGROUP':
     866                        case 'DD':
     867                        case 'DT':
     868                        case 'EMBED':
     869                        case 'FORM':
     870                        case 'FRAME':
     871                        case 'FRAMESET':
     872                        case 'HEAD':
     873                        case 'HR':
     874                        case 'HTML':
     875                        case 'IFRAME':
     876                        case 'INPUT':
     877                        case 'KEYGEN':
     878                        case 'LI':
     879                        case 'LINK':
     880                        case 'LISTING':
     881                        case 'MARQUEE':
     882                        case 'MATH':
     883                        case 'META':
     884                        case 'NOBR':
     885                        case 'NOEMBED':
     886                        case 'NOFRAMES':
     887                        case 'NOSCRIPT':
     888                        case 'OBJECT':
     889                        case 'OL':
     890                        case 'OPTGROUP':
     891                        case 'OPTION':
     892                        case 'PARAM':
     893                        case 'PLAINTEXT':
     894                        case 'PRE':
     895                        case 'RB':
     896                        case 'RP':
     897                        case 'RT':
     898                        case 'RTC':
     899                        case 'SARCASM':
     900                        case 'SCRIPT':
     901                        case 'SELECT':
     902                        case 'SOURCE':
     903                        case 'STYLE':
     904                        case 'SVG':
     905                        case 'TABLE':
     906                        case 'TBODY':
     907                        case 'TD':
     908                        case 'TEMPLATE':
     909                        case 'TEXTAREA':
     910                        case 'TFOOT':
     911                        case 'TH':
     912                        case 'THEAD':
     913                        case 'TITLE':
     914                        case 'TR':
     915                        case 'TRACK':
     916                        case 'UL':
     917                        case 'WBR':
     918                        case 'XMP':
    866919                                $this->last_error = self::ERROR_UNSUPPORTED;
    867920                                throw new WP_HTML_Unsupported_Exception( "Cannot process {$tag_name} element." );
     921                }
     922
     923                if ( ! $this->is_tag_closer() ) {
     924                        /*
     925                         * > Any other start tag
     926                         */
     927                        $this->reconstruct_active_formatting_elements();
     928                        $this->insert_html_element( $this->state->current_token );
     929                        return true;
     930                } else {
     931                        /*
     932                         * > Any other end tag
     933                         */
     934
     935                        /*
     936                         * Find the corresponding tag opener in the stack of open elements, if
     937                         * it exists before reaching a special element, which provides a kind
     938                         * of boundary in the stack. For example, a `</custom-tag>` should not
     939                         * close anything beyond its containing `P` or `DIV` element.
     940                         */
     941                        foreach ( $this->state->stack_of_open_elements->walk_up() as $node ) {
     942                                if ( $tag_name === $node->node_name ) {
     943                                        break;
     944                                }
     945
     946                                if ( self::is_special( $node->node_name ) ) {
     947                                        // This is a parse error, ignore the token.
     948                                        return $this->step();
     949                                }
     950                        }
     951
     952                        $this->generate_implied_end_tags( $tag_name );
     953                        if ( $node !== $this->state->stack_of_open_elements->current_node() ) {
     954                                // @todo Record parse error: this error doesn't impact parsing.
     955                        }
     956
     957                        foreach ( $this->state->stack_of_open_elements->walk_up() as $item ) {
     958                                $this->state->stack_of_open_elements->pop();
     959                                if ( $node === $item ) {
     960                                        return true;
     961                                }
     962                        }
    868963                }
    869964        }
     
    12651360                        // > If formatting element is not in the stack of open elements, then this is a parse error; remove the element from the list, and return.
    12661361                        if ( ! $this->state->stack_of_open_elements->contains_node( $formatting_element ) ) {
    1267                                 $this->state->active_formatting_elements->remove_node( $formatting_element->bookmark_name );
     1362                                $this->state->active_formatting_elements->remove_node( $formatting_element );
    12681363                                return;
    12691364                        }
  • trunk/tests/phpunit/tests/html-api/wpHtmlProcessor.php

    r57186 r57248  
    6262
    6363        /**
    64          * Ensures that if the HTML Processor encounters inputs that it can't properly handle,
    65          * that it stops processing the rest of the document. This prevents data corruption.
    66          *
    67          * @ticket 59167
    68          *
    69          * @covers WP_HTML_Processor::next_tag
    70          */
    71         public function test_stops_processing_after_unsupported_elements() {
    72                 $p = WP_HTML_Processor::create_fragment( '<p><x-not-supported></p><p></p>' );
    73                 $p->next_tag( 'P' );
    74                 $this->assertFalse( $p->next_tag(), 'Stepped into a tag after encountering X-NOT-SUPPORTED element when it should have aborted.' );
    75                 $this->assertNull( $p->get_tag(), "Should have aborted processing, but still reported tag {$p->get_tag()} after properly failing to step into tag." );
    76                 $this->assertFalse( $p->next_tag( 'P' ), 'Stepped into normal P element after X-NOT-SUPPORTED element when it should have aborted.' );
    77         }
    78 
    79         /**
    8064         * Ensures that the HTML Processor maintains its internal state through seek calls.
    8165         *
     
    148132                $this->assertFalse( $p->next_tag( 'EM' ), 'Should have aborted before finding second EM as it required reconstructing the first EM.' );
    149133        }
     134
     135        /**
     136         * Ensures that special handling of unsupported tags is cleaned up
     137         * as handling is implemented. Otherwise there's risk of leaving special
     138         * handling (that is never reached) when tag handling is implemented.
     139         *
     140         * @ticket 60092
     141         *
     142         * @dataProvider data_unsupported_special_in_body_tags
     143         *
     144         * @covers WP_HTML_Processor::step_in_body
     145         *
     146         * @param string $tag_name Name of the tag to test.
     147         */
     148        public function test_step_in_body_fails_on_unsupported_tags( $tag_name ) {
     149                $fragment = WP_HTML_Processor::create_fragment( '<' . $tag_name . '></' . $tag_name . '>' );
     150                $this->assertFalse( $fragment->next_tag(), 'Should fail to find tag: ' . $tag_name . '.' );
     151                $this->assertEquals( $fragment->get_last_error(), WP_HTML_Processor::ERROR_UNSUPPORTED, 'Should have unsupported last error.' );
     152        }
     153
     154        /**
     155         * Data provider.
     156         *
     157         * @return array[]
     158         */
     159        public function data_unsupported_special_in_body_tags() {
     160                return array(
     161                        'APPLET'    => array( 'APPLET' ),
     162                        'AREA'      => array( 'AREA' ),
     163                        'BASE'      => array( 'BASE' ),
     164                        'BASEFONT'  => array( 'BASEFONT' ),
     165                        'BGSOUND'   => array( 'BGSOUND' ),
     166                        'BODY'      => array( 'BODY' ),
     167                        'BR'        => array( 'BR' ),
     168                        'CAPTION'   => array( 'CAPTION' ),
     169                        'COL'       => array( 'COL' ),
     170                        'COLGROUP'  => array( 'COLGROUP' ),
     171                        'DD'        => array( 'DD' ),
     172                        'DT'        => array( 'DT' ),
     173                        'EMBED'     => array( 'EMBED' ),
     174                        'FORM'      => array( 'FORM' ),
     175                        'FRAME'     => array( 'FRAME' ),
     176                        'FRAMESET'  => array( 'FRAMESET' ),
     177                        'HEAD'      => array( 'HEAD' ),
     178                        'HR'        => array( 'HR' ),
     179                        'HTML'      => array( 'HTML' ),
     180                        'IFRAME'    => array( 'IFRAME' ),
     181                        'INPUT'     => array( 'INPUT' ),
     182                        'KEYGEN'    => array( 'KEYGEN' ),
     183                        'LI'        => array( 'LI' ),
     184                        'LINK'      => array( 'LINK' ),
     185                        'LISTING'   => array( 'LISTING' ),
     186                        'MARQUEE'   => array( 'MARQUEE' ),
     187                        'MATH'      => array( 'MATH' ),
     188                        'META'      => array( 'META' ),
     189                        'NOBR'      => array( 'NOBR' ),
     190                        'NOEMBED'   => array( 'NOEMBED' ),
     191                        'NOFRAMES'  => array( 'NOFRAMES' ),
     192                        'NOSCRIPT'  => array( 'NOSCRIPT' ),
     193                        'OBJECT'    => array( 'OBJECT' ),
     194                        'OL'        => array( 'OL' ),
     195                        'OPTGROUP'  => array( 'OPTGROUP' ),
     196                        'OPTION'    => array( 'OPTION' ),
     197                        'PARAM'     => array( 'PARAM' ),
     198                        'PLAINTEXT' => array( 'PLAINTEXT' ),
     199                        'PRE'       => array( 'PRE' ),
     200                        'RB'        => array( 'RB' ),
     201                        'RP'        => array( 'RP' ),
     202                        'RT'        => array( 'RT' ),
     203                        'RTC'       => array( 'RTC' ),
     204                        'SARCASM'   => array( 'SARCASM' ),
     205                        'SCRIPT'    => array( 'SCRIPT' ),
     206                        'SELECT'    => array( 'SELECT' ),
     207                        'SOURCE'    => array( 'SOURCE' ),
     208                        'STYLE'     => array( 'STYLE' ),
     209                        'SVG'       => array( 'SVG' ),
     210                        'TABLE'     => array( 'TABLE' ),
     211                        'TBODY'     => array( 'TBODY' ),
     212                        'TD'        => array( 'TD' ),
     213                        'TEMPLATE'  => array( 'TEMPLATE' ),
     214                        'TEXTAREA'  => array( 'TEXTAREA' ),
     215                        'TFOOT'     => array( 'TFOOT' ),
     216                        'TH'        => array( 'TH' ),
     217                        'THEAD'     => array( 'THEAD' ),
     218                        'TITLE'     => array( 'TITLE' ),
     219                        'TR'        => array( 'TR' ),
     220                        'TRACK'     => array( 'TRACK' ),
     221                        'UL'        => array( 'UL' ),
     222                        'WBR'       => array( 'WBR' ),
     223                        'XMP'       => array( 'XMP' ),
     224                );
     225        }
    150226}
  • trunk/tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php

    r57186 r57248  
    3838                $supported_elements = array(
    3939                        'A',
     40                        'ABBR',
     41                        'ACRONYM', // Neutralized
    4042                        'ADDRESS',
    4143                        'ARTICLE',
    4244                        'ASIDE',
     45                        'AUDIO',
    4346                        'B',
     47                        'BDI',
     48                        'BDO',
    4449                        'BIG',
     50                        'BLINK', // Deprecated
    4551                        'BUTTON',
     52                        'CANVAS',
    4653                        'CENTER', // Neutralized
     54                        'CITE',
    4755                        'CODE',
     56                        'DATA',
     57                        'DATALIST',
     58                        'DFN',
     59                        'DEL',
    4860                        'DETAILS',
    4961                        'DIALOG',
     
    6779                        'I',
    6880                        'IMG',
     81                        'INS',
     82                        'ISINDEX', // Deprecated
     83                        'KBD',
     84                        'LABEL',
     85                        'LEGEND',
    6986                        'MAIN',
     87                        'MAP',
     88                        'MARK',
    7089                        'MENU',
     90                        'METER',
     91                        'MULTICOL', // Deprecated
    7192                        'NAV',
     93                        'NEXTID', // Deprecated
     94                        'OUTPUT',
    7295                        'P',
     96                        'PICTURE',
     97                        'PROGRESS',
     98                        'Q',
     99                        'RUBY',
     100                        'SAMP',
    73101                        'SEARCH',
    74102                        'SECTION',
     103                        'SLOT',
    75104                        'SMALL',
     105                        'SPACER', // Deprecated
    76106                        'SPAN',
    77107                        'STRIKE',
    78108                        'STRONG',
     109                        'SUB',
    79110                        'SUMMARY',
     111                        'SUP',
     112                        'TIME',
    80113                        'TT',
    81114                        'U',
     115                        'VAR',
     116                        'VIDEO',
    82117                );
    83118
     
    122157        public function data_unsupported_elements() {
    123158                $unsupported_elements = array(
    124                         'ABBR',
    125                         'ACRONYM', // Neutralized
    126159                        'APPLET', // Deprecated
    127160                        'AREA',
    128                         'AUDIO',
    129161                        'BASE',
    130                         'BDI',
    131                         'BDO',
    132162                        'BGSOUND', // Deprecated; self-closing if self-closing flag provided, otherwise normal.
    133                         'BLINK', // Deprecated
    134163                        'BODY',
    135164                        'BR',
    136                         'CANVAS',
    137165                        'CAPTION',
    138                         'CITE',
    139166                        'COL',
    140167                        'COLGROUP',
    141                         'DATA',
    142                         'DATALIST',
    143168                        'DD',
    144                         'DEL',
    145                         'DEFN',
    146169                        'DT',
    147170                        'EMBED',
     
    154177                        'IFRAME',
    155178                        'INPUT',
    156                         'INS',
    157                         'ISINDEX', // Deprecated
    158                         'KBD',
    159179                        'KEYGEN', // Deprecated; void
    160                         'LABEL',
    161                         'LEGEND',
    162180                        'LI',
    163181                        'LINK',
    164182                        'LISTING', // Deprecated, use PRE instead.
    165                         'MAP',
    166                         'MARK',
    167183                        'MARQUEE', // Deprecated
    168184                        'MATH',
    169185                        'META',
    170                         'METER',
    171                         'MULTICOL', // Deprecated
    172                         'NEXTID', // Deprecated
    173186                        'NOBR', // Neutralized
    174187                        'NOEMBED', // Neutralized
     
    179192                        'OPTGROUP',
    180193                        'OPTION',
    181                         'OUTPUT',
    182                         'PICTURE',
    183194                        'PLAINTEXT', // Neutralized
    184195                        'PRE',
    185                         'PROGRESS',
    186                         'Q',
    187196                        'RB', // Neutralized
    188197                        'RP',
    189198                        'RT',
    190199                        'RTC', // Neutralized
    191                         'RUBY',
    192                         'SAMP',
    193200                        'SCRIPT',
    194201                        'SELECT',
    195                         'SLOT',
    196202                        'SOURCE',
    197                         'SPACER', // Deprecated
    198203                        'STYLE',
    199                         'SUB',
    200                         'SUP',
    201204                        'SVG',
    202205                        'TABLE',
     
    208211                        'TH',
    209212                        'THEAD',
    210                         'TIME',
    211213                        'TITLE',
    212214                        'TR',
    213215                        'TRACK',
    214216                        'UL',
    215                         'VAR',
    216                         'VIDEO',
    217217                        'WBR',
    218218                        'XMP', // Deprecated, use PRE instead.
    219 
    220                         // Made up elements, custom elements.
    221                         'X-NOT-AN-HTML-ELEMENT',
    222                         'HUMAN-TIME',
    223219                );
    224220
     
    361357                        'H5 after unclosed H4 inside H2'        => array( '<h2><span>Major<h4>Minor</span></h3><h5 target>', array( 'HTML', 'BODY', 'H2', 'SPAN', 'H5' ), 1 ),
    362358                        'H5 after H4 inside H2'                 => array( '<h2><span>Major<h4>Minor</h4></span></h3><h5 target>', array( 'HTML', 'BODY', 'H5' ), 1 ),
     359
     360                        // Custom elements.
     361                        'WP-EMOJI'                              => array( '<div><wp-emoji target></wp-emoji></div>', array( 'HTML', 'BODY', 'DIV', 'WP-EMOJI' ), 1 ),
     362                        'WP-EMOJI then IMG'                     => array( '<div><wp-emoji></wp-emoji><img target></div>', array( 'HTML', 'BODY', 'DIV', 'IMG' ), 1 ),
    363363                );
    364364        }
  • trunk/tests/phpunit/tests/html-api/wpHtmlSupportRequiredOpenElements.php

    r56790 r57248  
    7373                $this->ensure_support_is_added_everywhere( 'TEMPLATE' );
    7474
    75                 // MathML Elements
    76                 $this->ensure_support_is_added_everywhere( 'MI' );
    77                 $this->ensure_support_is_added_everywhere( 'MO' );
    78                 $this->ensure_support_is_added_everywhere( 'MN' );
    79                 $this->ensure_support_is_added_everywhere( 'MS' );
    80                 $this->ensure_support_is_added_everywhere( 'MTEXT' );
    81                 $this->ensure_support_is_added_everywhere( 'ANNOTATION-XML' );
    82 
    83                 /*
    84                  * SVG elements: note that TITLE is both an HTML element and an SVG element
    85                  * so care must be taken when adding support for either one.
    86                  */
    87                 $this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
    88                 $this->ensure_support_is_added_everywhere( 'DESC' );
    89                 $this->ensure_support_is_added_everywhere( 'TITLE' );
     75                // MathML Elements: MI, MO, MN, MS, MTEXT, ANNOTATION-XML.
     76                $this->ensure_support_is_added_everywhere( 'MATH' );
     77
     78                /*
     79                 * SVG elements: note that TITLE is both an HTML element and an SVG element
     80                 * so care must be taken when adding support for either one.
     81                 *
     82                 * FOREIGNOBJECT, DESC, TITLE.
     83                 */
     84                $this->ensure_support_is_added_everywhere( 'SVG' );
    9085        }
    9186
     
    116111                $this->ensure_support_is_added_everywhere( 'TEMPLATE' );
    117112
    118                 // MathML Elements
    119                 $this->ensure_support_is_added_everywhere( 'MI' );
    120                 $this->ensure_support_is_added_everywhere( 'MO' );
    121                 $this->ensure_support_is_added_everywhere( 'MN' );
    122                 $this->ensure_support_is_added_everywhere( 'MS' );
    123                 $this->ensure_support_is_added_everywhere( 'MTEXT' );
    124                 $this->ensure_support_is_added_everywhere( 'ANNOTATION-XML' );
    125 
    126                 /*
    127                  * SVG elements: note that TITLE is both an HTML element and an SVG element
    128                  * so care must be taken when adding support for either one.
    129                  */
    130                 $this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
    131                 $this->ensure_support_is_added_everywhere( 'DESC' );
    132                 $this->ensure_support_is_added_everywhere( 'TITLE' );
     113                // MathML Elements: MI, MO, MN, MS, MTEXT, ANNOTATION-XML.
     114                $this->ensure_support_is_added_everywhere( 'MATH' );
     115
     116                /*
     117                 * SVG elements: note that TITLE is both an HTML element and an SVG element
     118                 * so care must be taken when adding support for either one.
     119                 *
     120                 * FOREIGNOBJECT, DESC, TITLE.
     121                 */
     122                $this->ensure_support_is_added_everywhere( 'SVG' );
    133123
    134124                // These elements are specific to list item scope.
     
    162152                $this->ensure_support_is_added_everywhere( 'TEMPLATE' );
    163153
    164                 // MathML Elements
    165                 $this->ensure_support_is_added_everywhere( 'MI' );
    166                 $this->ensure_support_is_added_everywhere( 'MO' );
    167                 $this->ensure_support_is_added_everywhere( 'MN' );
    168                 $this->ensure_support_is_added_everywhere( 'MS' );
    169                 $this->ensure_support_is_added_everywhere( 'MTEXT' );
    170                 $this->ensure_support_is_added_everywhere( 'ANNOTATION-XML' );
    171 
    172                 /*
    173                  * SVG elements: note that TITLE is both an HTML element and an SVG element
    174                  * so care must be taken when adding support for either one.
    175                  */
    176                 $this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
    177                 $this->ensure_support_is_added_everywhere( 'DESC' );
    178                 $this->ensure_support_is_added_everywhere( 'TITLE' );
     154                // MathML Elements: MI, MO, MN, MS, MTEXT, ANNOTATION-XML.
     155                $this->ensure_support_is_added_everywhere( 'MATH' );
     156
     157                /*
     158                 * SVG elements: note that TITLE is both an HTML element and an SVG element
     159                 * so care must be taken when adding support for either one.
     160                 *
     161                 * FOREIGNOBJECT, DESC, TITLE.
     162                 */
     163                $this->ensure_support_is_added_everywhere( 'SVG' );
    179164        }
    180165
     
    202187                $this->ensure_support_is_added_everywhere( 'TEMPLATE' );
    203188
    204                 // MathML Elements
    205                 $this->ensure_support_is_added_everywhere( 'MI' );
    206                 $this->ensure_support_is_added_everywhere( 'MO' );
    207                 $this->ensure_support_is_added_everywhere( 'MN' );
    208                 $this->ensure_support_is_added_everywhere( 'MS' );
    209                 $this->ensure_support_is_added_everywhere( 'MTEXT' );
    210                 $this->ensure_support_is_added_everywhere( 'ANNOTATION-XML' );
    211 
    212                 /*
    213                  * SVG elements: note that TITLE is both an HTML element and an SVG element
    214                  * so care must be taken when adding support for either one.
    215                  */
    216                 $this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
    217                 $this->ensure_support_is_added_everywhere( 'DESC' );
    218                 $this->ensure_support_is_added_everywhere( 'TITLE' );
     189                // MathML Elements: MI, MO, MN, MS, MTEXT, ANNOTATION-XML.
     190                $this->ensure_support_is_added_everywhere( 'MATH' );
     191
     192                /*
     193                 * SVG elements: note that TITLE is both an HTML element and an SVG element
     194                 * so care must be taken when adding support for either one.
     195                 *
     196                 * FOREIGNOBJECT, DESC, TITLE.
     197                 */
     198                $this->ensure_support_is_added_everywhere( 'SVG' );
    219199        }
    220200
     
    242222                $this->ensure_support_is_added_everywhere( 'TEMPLATE' );
    243223
    244                 // MathML Elements
    245                 $this->ensure_support_is_added_everywhere( 'MI' );
    246                 $this->ensure_support_is_added_everywhere( 'MO' );
    247                 $this->ensure_support_is_added_everywhere( 'MN' );
    248                 $this->ensure_support_is_added_everywhere( 'MS' );
    249                 $this->ensure_support_is_added_everywhere( 'MTEXT' );
    250                 $this->ensure_support_is_added_everywhere( 'ANNOTATION-XML' );
    251 
    252                 /*
    253                  * SVG elements: note that TITLE is both an HTML element and an SVG element
    254                  * so care must be taken when adding support for either one.
    255                  */
    256                 $this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
    257                 $this->ensure_support_is_added_everywhere( 'DESC' );
    258                 $this->ensure_support_is_added_everywhere( 'TITLE' );
     224                // MathML Elements: MI, MO, MN, MS, MTEXT, ANNOTATION-XML.
     225                $this->ensure_support_is_added_everywhere( 'MATH' );
     226
     227                /*
     228                 * SVG elements: note that TITLE is both an HTML element and an SVG element
     229                 * so care must be taken when adding support for either one.
     230                 *
     231                 * FOREIGNOBJECT, DESC, TITLE.
     232                 */
     233                $this->ensure_support_is_added_everywhere( 'SVG' );
    259234        }
    260235
     
    281256                $this->ensure_support_is_added_everywhere( 'TEMPLATE' );
    282257
    283                 // MathML Elements
    284                 $this->ensure_support_is_added_everywhere( 'MI' );
    285                 $this->ensure_support_is_added_everywhere( 'MO' );
    286                 $this->ensure_support_is_added_everywhere( 'MN' );
    287                 $this->ensure_support_is_added_everywhere( 'MS' );
    288                 $this->ensure_support_is_added_everywhere( 'MTEXT' );
    289                 $this->ensure_support_is_added_everywhere( 'ANNOTATION-XML' );
    290 
    291                 /*
    292                  * SVG elements: note that TITLE is both an HTML element and an SVG element
    293                  * so care must be taken when adding support for either one.
    294                  */
    295                 $this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
    296                 $this->ensure_support_is_added_everywhere( 'DESC' );
    297                 $this->ensure_support_is_added_everywhere( 'TITLE' );
     258                // MathML Elements: MI, MO, MN, MS, MTEXT, ANNOTATION-XML.
     259                $this->ensure_support_is_added_everywhere( 'MATH' );
     260
     261                /*
     262                 * SVG elements: note that TITLE is both an HTML element and an SVG element
     263                 * so care must be taken when adding support for either one.
     264                 *
     265                 * FOREIGNOBJECT, DESC, TITLE.
     266                 */
     267                $this->ensure_support_is_added_everywhere( 'SVG' );
    298268
    299269                // These elements are specific to TABLE scope.
     
    336306                $this->ensure_support_is_added_everywhere( 'TEMPLATE' );
    337307
    338                 // MathML Elements
    339                 $this->ensure_support_is_added_everywhere( 'MI' );
    340                 $this->ensure_support_is_added_everywhere( 'MO' );
    341                 $this->ensure_support_is_added_everywhere( 'MN' );
    342                 $this->ensure_support_is_added_everywhere( 'MS' );
    343                 $this->ensure_support_is_added_everywhere( 'MTEXT' );
    344                 $this->ensure_support_is_added_everywhere( 'ANNOTATION-XML' );
    345 
    346                 /*
    347                  * SVG elements: note that TITLE is both an HTML element and an SVG element
    348                  * so care must be taken when adding support for either one.
    349                  */
    350                 $this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
    351                 $this->ensure_support_is_added_everywhere( 'DESC' );
    352                 $this->ensure_support_is_added_everywhere( 'TITLE' );
     308                // MathML Elements: MI, MO, MN, MS, MTEXT, ANNOTATION-XML.
     309                $this->ensure_support_is_added_everywhere( 'MATH' );
     310
     311                /*
     312                 * SVG elements: note that TITLE is both an HTML element and an SVG element
     313                 * so care must be taken when adding support for either one.
     314                 *
     315                 * FOREIGNOBJECT, DESC, TITLE.
     316                 */
     317                $this->ensure_support_is_added_everywhere( 'SVG' );
    353318
    354319                // These elements are specific to SELECT scope.
Note: See TracChangeset for help on using the changeset viewer.