Skip to content

Commit

Permalink
Update more tests, more checks, add SARCASM
Browse files Browse the repository at this point in the history
  • Loading branch information
dmsnell authored and sirreal committed Dec 22, 2023
1 parent 2a8fc46 commit eb99542
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 107 deletions.
3 changes: 1 addition & 2 deletions src/wp-includes/html-api/class-wp-html-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -879,8 +879,6 @@ private function step_in_body() {
* @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inbody
*/
switch ( $tag_name ) {
case 'ABBR':
case 'ACRONYM':
case 'APPLET':
case 'AREA':
case 'BASE':
Expand Down Expand Up @@ -924,6 +922,7 @@ private function step_in_body() {
case 'RP':
case 'RT':
case 'RTC':
case 'SARCASM':
case 'SCRIPT':
case 'SELECT':
case 'SOURCE':
Expand Down
1 change: 1 addition & 0 deletions tests/phpunit/tests/html-api/wpHtmlProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ public function data_unsupported_special_in_body_tags() {
array( 'RP' ),
array( 'RT' ),
array( 'RTC' ),
array( 'SARCASM' ),
array( 'SCRIPT' ),
array( 'SELECT' ),
array( 'SOURCE' ),
Expand Down
70 changes: 35 additions & 35 deletions tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,26 @@ public function test_navigates_into_normative_html_for_supported_elements( $html
public function data_single_tag_of_supported_elements() {
$supported_elements = array(
'A',
'ABBR',
'ACRONYM', // Neutralized
'ADDRESS',
'ARTICLE',
'ASIDE',
'AUDIO',
'B',
'BDI',
'BDO',
'BIG',
'BLINK', // Deprecated
'BUTTON',
'CANVAS',
'CENTER', // Neutralized
'CITE',
'CODE',
'DATA',
'DATALIST',
'DEFN',
'DEL',
'DETAILS',
'DIALOG',
'DIR',
Expand All @@ -66,19 +78,42 @@ public function data_single_tag_of_supported_elements() {
'HGROUP',
'I',
'IMG',
'INS',
'ISINDEX', // Deprecated
'KBD',
'LABEL',
'LEGEND',
'MAIN',
'MAP',
'MARK',
'MENU',
'METER',
'MULTICOL', // Deprecated
'NAV',
'NEXTID',// Deprecated
'OUTPUT',
'P',
'PICTURE',
'PROGRESS',
'Q',
'RUBY',
'SAMP',
'SEARCH',
'SECTION',
'SLOT',
'SMALL',
'SPACER', // Deprecated
'SPAN',
'STRIKE',
'STRONG',
'SUB',
'SUMMARY',
'SUP',
'TIME',
'TT',
'U',
'VAR',
'VIDEO',
);

$data = array();
Expand Down Expand Up @@ -121,28 +156,16 @@ public function test_fails_when_encountering_unsupported_tag( $html ) {
*/
public function data_unsupported_elements() {
$unsupported_elements = array(
'ABBR',
'ACRONYM', // Neutralized
'APPLET', // Deprecated
'AREA',
'AUDIO',
'BASE',
'BDI',
'BDO',
'BGSOUND', // Deprecated; self-closing if self-closing flag provided, otherwise normal.
'BLINK', // Deprecated
'BODY',
'BR',
'CANVAS',
'CAPTION',
'CITE',
'COL',
'COLGROUP',
'DATA',
'DATALIST',
'DD',
'DEL',
'DEFN',
'DT',
'EMBED',
'FORM',
Expand All @@ -153,23 +176,13 @@ public function data_unsupported_elements() {
'HTML',
'IFRAME',
'INPUT',
'INS',
'ISINDEX', // Deprecated
'KBD',
'KEYGEN', // Deprecated; void
'LABEL',
'LEGEND',
'LI',
'LINK',
'LISTING', // Deprecated, use PRE instead.
'MAP',
'MARK',
'MARQUEE', // Deprecated
'MATH',
'META',
'METER',
'MULTICOL', // Deprecated
'NEXTID', // Deprecated
'NOBR', // Neutralized
'NOEMBED', // Neutralized
'NOFRAMES', // Neutralized
Expand All @@ -178,26 +191,16 @@ public function data_unsupported_elements() {
'OL',
'OPTGROUP',
'OPTION',
'OUTPUT',
'PICTURE',
'PLAINTEXT', // Neutralized
'PRE',
'PROGRESS',
'Q',
'RB', // Neutralized
'RP',
'RT',
'RTC', // Neutralized
'RUBY',
'SAMP',
'SCRIPT',
'SELECT',
'SLOT',
'SOURCE',
'SPACER', // Deprecated
'STYLE',
'SUB',
'SUP',
'SVG',
'TABLE',
'TBODY',
Expand All @@ -207,13 +210,10 @@ public function data_unsupported_elements() {
'TFOOT',
'TH',
'THEAD',
'TIME',
'TITLE',
'TR',
'TRACK',
'UL',
'VAR',
'VIDEO',
'WBR',
'XMP', // Deprecated, use PRE instead.
);
Expand Down
91 changes: 21 additions & 70 deletions tests/phpunit/tests/html-api/wpHtmlSupportRequiredOpenElements.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,14 @@ public function test_has_element_in_scope_needs_support() {
$this->ensure_support_is_added_everywhere( 'OBJECT' );
$this->ensure_support_is_added_everywhere( 'TEMPLATE' );

// MathML Elements
$this->ensure_support_is_added_everywhere( 'MI' );
$this->ensure_support_is_added_everywhere( 'MO' );
$this->ensure_support_is_added_everywhere( 'MN' );
$this->ensure_support_is_added_everywhere( 'MS' );
$this->ensure_support_is_added_everywhere( 'MTEXT' );
$this->ensure_support_is_added_everywhere( 'ANNOTATION-XML' );
// MathML Elements.
$this->ensure_support_is_added_everywhere( 'MATH' );

/*
* SVG elements: note that TITLE is both an HTML element and an SVG element
* so care must be taken when adding support for either one.
*/
$this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
$this->ensure_support_is_added_everywhere( 'DESC' );
$this->ensure_support_is_added_everywhere( 'TITLE' );
$this->ensure_support_is_added_everywhere( 'SVG' );
}

/**
Expand Down Expand Up @@ -115,21 +108,14 @@ public function test_has_element_in_list_item_scope_needs_support() {
$this->ensure_support_is_added_everywhere( 'OBJECT' );
$this->ensure_support_is_added_everywhere( 'TEMPLATE' );

// MathML Elements
$this->ensure_support_is_added_everywhere( 'MI' );
$this->ensure_support_is_added_everywhere( 'MO' );
$this->ensure_support_is_added_everywhere( 'MN' );
$this->ensure_support_is_added_everywhere( 'MS' );
$this->ensure_support_is_added_everywhere( 'MTEXT' );
$this->ensure_support_is_added_everywhere( 'ANNOTATION-XML' );
// MathML Elements.
$this->ensure_support_is_added_everywhere( 'MATH' );

/*
* SVG elements: note that TITLE is both an HTML element and an SVG element
* so care must be taken when adding support for either one.
*/
$this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
$this->ensure_support_is_added_everywhere( 'DESC' );
$this->ensure_support_is_added_everywhere( 'TITLE' );
$this->ensure_support_is_added_everywhere( 'SVG' );

// These elements are specific to list item scope.
$this->ensure_support_is_added_everywhere( 'OL' );
Expand Down Expand Up @@ -161,21 +147,14 @@ public function test_has_element_in_button_scope_needs_support() {
$this->ensure_support_is_added_everywhere( 'OBJECT' );
$this->ensure_support_is_added_everywhere( 'TEMPLATE' );

// MathML Elements
$this->ensure_support_is_added_everywhere( 'MI' );
$this->ensure_support_is_added_everywhere( 'MO' );
$this->ensure_support_is_added_everywhere( 'MN' );
$this->ensure_support_is_added_everywhere( 'MS' );
$this->ensure_support_is_added_everywhere( 'MTEXT' );
$this->ensure_support_is_added_everywhere( 'ANNOTATION-XML' );
// MathML Elements.
$this->ensure_support_is_added_everywhere( 'MATH' );

/*
* SVG elements: note that TITLE is both an HTML element and an SVG element
* so care must be taken when adding support for either one.
*/
$this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
$this->ensure_support_is_added_everywhere( 'DESC' );
$this->ensure_support_is_added_everywhere( 'TITLE' );
$this->ensure_support_is_added_everywhere( 'SVG' );
}

/**
Expand All @@ -201,21 +180,14 @@ public function test_after_element_pop_must_maintain_p_in_button_scope_flag() {
$this->ensure_support_is_added_everywhere( 'OBJECT' );
$this->ensure_support_is_added_everywhere( 'TEMPLATE' );

// MathML Elements
$this->ensure_support_is_added_everywhere( 'MI' );
$this->ensure_support_is_added_everywhere( 'MO' );
$this->ensure_support_is_added_everywhere( 'MN' );
$this->ensure_support_is_added_everywhere( 'MS' );
$this->ensure_support_is_added_everywhere( 'MTEXT' );
$this->ensure_support_is_added_everywhere( 'ANNOTATION-XML' );
// MathML Elements.
$this->ensure_support_is_added_everywhere( 'MATH' );

/*
* SVG elements: note that TITLE is both an HTML element and an SVG element
* so care must be taken when adding support for either one.
*/
$this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
$this->ensure_support_is_added_everywhere( 'DESC' );
$this->ensure_support_is_added_everywhere( 'TITLE' );
$this->ensure_support_is_added_everywhere( 'SVG' );
}

/**
Expand All @@ -241,21 +213,14 @@ public function test_after_element_push_must_maintain_p_in_button_scope_flag() {
$this->ensure_support_is_added_everywhere( 'OBJECT' );
$this->ensure_support_is_added_everywhere( 'TEMPLATE' );

// MathML Elements
$this->ensure_support_is_added_everywhere( 'MI' );
$this->ensure_support_is_added_everywhere( 'MO' );
$this->ensure_support_is_added_everywhere( 'MN' );
$this->ensure_support_is_added_everywhere( 'MS' );
$this->ensure_support_is_added_everywhere( 'MTEXT' );
$this->ensure_support_is_added_everywhere( 'ANNOTATION-XML' );
// MathML Elements.
$this->ensure_support_is_added_everywhere( 'MATH' );

/*
* SVG elements: note that TITLE is both an HTML element and an SVG element
* so care must be taken when adding support for either one.
*/
$this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
$this->ensure_support_is_added_everywhere( 'DESC' );
$this->ensure_support_is_added_everywhere( 'TITLE' );
$this->ensure_support_is_added_everywhere( 'SVG' );
}

/**
Expand All @@ -280,21 +245,14 @@ public function test_has_element_in_table_scope_needs_support() {
$this->ensure_support_is_added_everywhere( 'OBJECT' );
$this->ensure_support_is_added_everywhere( 'TEMPLATE' );

// MathML Elements
$this->ensure_support_is_added_everywhere( 'MI' );
$this->ensure_support_is_added_everywhere( 'MO' );
$this->ensure_support_is_added_everywhere( 'MN' );
$this->ensure_support_is_added_everywhere( 'MS' );
$this->ensure_support_is_added_everywhere( 'MTEXT' );
$this->ensure_support_is_added_everywhere( 'ANNOTATION-XML' );
// MathML Elements.
$this->ensure_support_is_added_everywhere( 'MATH' );

/*
* SVG elements: note that TITLE is both an HTML element and an SVG element
* so care must be taken when adding support for either one.
*/
$this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
$this->ensure_support_is_added_everywhere( 'DESC' );
$this->ensure_support_is_added_everywhere( 'TITLE' );
$this->ensure_support_is_added_everywhere( 'SVG' );

// These elements are specific to TABLE scope.
$this->ensure_support_is_added_everywhere( 'HTML' );
Expand Down Expand Up @@ -335,21 +293,14 @@ public function test_has_element_in_select_scope_needs_support() {
$this->ensure_support_is_added_everywhere( 'OBJECT' );
$this->ensure_support_is_added_everywhere( 'TEMPLATE' );

// MathML Elements
$this->ensure_support_is_added_everywhere( 'MI' );
$this->ensure_support_is_added_everywhere( 'MO' );
$this->ensure_support_is_added_everywhere( 'MN' );
$this->ensure_support_is_added_everywhere( 'MS' );
$this->ensure_support_is_added_everywhere( 'MTEXT' );
$this->ensure_support_is_added_everywhere( 'ANNOTATION-XML' );
// MathML Elements.
$this->ensure_support_is_added_everywhere( 'MATH' );

/*
* SVG elements: note that TITLE is both an HTML element and an SVG element
* so care must be taken when adding support for either one.
*/
$this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
$this->ensure_support_is_added_everywhere( 'DESC' );
$this->ensure_support_is_added_everywhere( 'TITLE' );
$this->ensure_support_is_added_everywhere( 'SVG' );

// These elements are specific to SELECT scope.
$this->ensure_support_is_added_everywhere( 'OPTGROUP' );
Expand Down

0 comments on commit eb99542

Please sign in to comment.