Skip to content

Commit edcc85c

Browse files
committed
HTML API: Cleanup tests and list of void elements.
This patch adds newly supported elements to tests that should have been updated in recent PRs, but which were merged without that. Those PRs removed failing tests showing that the elements were unsupported, but did not add the elements to the list of supported ones. It also removes some elements from the special-exclusion list of unsupported IN BODY elements. These did not present in failing tests because earlier conditions in the switch structure caught the tags before hitting the default block. Finally it adds some missing elements to the list of void elements. These elements are not listed as void in the HTML specification because they are deprecated. However, they are treated as void for the sake of HTML serialization and the parsing rules indicate that they behave as void elements, so it's safe to list them within the HTML API as void. Developed in #5913 Fixes #60307 git-svn-id: https://develop.svn.wordpress.org/trunk@57319 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 3d154d7 commit edcc85c

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

src/wp-includes/html-api/class-wp-html-processor.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,24 +1002,20 @@ private function step_in_body() {
10021002
*/
10031003
switch ( $tag_name ) {
10041004
case 'APPLET':
1005-
case 'AREA':
10061005
case 'BASE':
10071006
case 'BASEFONT':
10081007
case 'BGSOUND':
10091008
case 'BODY':
10101009
case 'CAPTION':
10111010
case 'COL':
10121011
case 'COLGROUP':
1013-
case 'DD':
1014-
case 'DT':
10151012
case 'FORM':
10161013
case 'FRAME':
10171014
case 'FRAMESET':
10181015
case 'HEAD':
10191016
case 'HTML':
10201017
case 'IFRAME':
10211018
case 'INPUT':
1022-
case 'LI':
10231019
case 'LINK':
10241020
case 'MARQUEE':
10251021
case 'MATH':
@@ -1029,7 +1025,6 @@ private function step_in_body() {
10291025
case 'NOFRAMES':
10301026
case 'NOSCRIPT':
10311027
case 'OBJECT':
1032-
case 'OL':
10331028
case 'OPTGROUP':
10341029
case 'OPTION':
10351030
case 'PARAM':
@@ -1055,7 +1050,6 @@ private function step_in_body() {
10551050
case 'TITLE':
10561051
case 'TR':
10571052
case 'TRACK':
1058-
case 'UL':
10591053
case 'XMP':
10601054
$this->last_error = self::ERROR_UNSUPPORTED;
10611055
throw new WP_HTML_Unsupported_Exception( "Cannot process {$tag_name} element." );
@@ -1709,15 +1703,19 @@ public static function is_void( $tag_name ) {
17091703
return (
17101704
'AREA' === $tag_name ||
17111705
'BASE' === $tag_name ||
1706+
'BASEFONT' === $tag_name || // Obsolete but still treated as void.
1707+
'BGSOUND' === $tag_name || // Obsolete but still treated as void.
17121708
'BR' === $tag_name ||
17131709
'COL' === $tag_name ||
17141710
'EMBED' === $tag_name ||
1711+
'FRAME' === $tag_name ||
17151712
'HR' === $tag_name ||
17161713
'IMG' === $tag_name ||
17171714
'INPUT' === $tag_name ||
17181715
'LINK' === $tag_name ||
17191716
'KEYGEN' === $tag_name || // Obsolete but still treated as void.
17201717
'META' === $tag_name ||
1718+
'PARAM' === $tag_name || // Obsolete but still treated as void.
17211719
'SOURCE' === $tag_name ||
17221720
'TRACK' === $tag_name ||
17231721
'WBR' === $tag_name

tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function data_single_tag_of_supported_elements() {
4040
'ABBR',
4141
'ACRONYM', // Neutralized.
4242
'ADDRESS',
43+
'AREA',
4344
'ARTICLE',
4445
'ASIDE',
4546
'AUDIO',
@@ -48,6 +49,7 @@ public function data_single_tag_of_supported_elements() {
4849
'BDO',
4950
'BIG',
5051
'BLINK', // Deprecated.
52+
'BR',
5153
'BUTTON',
5254
'CANVAS',
5355
'CENTER', // Neutralized.
@@ -65,6 +67,7 @@ public function data_single_tag_of_supported_elements() {
6567
'DL',
6668
'DT',
6769
'EM',
70+
'EMBED',
6871
'FIELDSET',
6972
'FIGCAPTION',
7073
'FIGURE',
@@ -78,22 +81,25 @@ public function data_single_tag_of_supported_elements() {
7881
'H6',
7982
'HEADER',
8083
'HGROUP',
84+
'HR',
8185
'I',
8286
'IMG',
8387
'INS',
8488
'LI',
85-
'ISINDEX', // Deprecated
89+
'ISINDEX', // Deprecated.
8690
'KBD',
91+
'KEYGEN', // Deprecated.
8792
'LABEL',
8893
'LEGEND',
94+
'LISTING', // Deprecated.
8995
'MAIN',
9096
'MAP',
9197
'MARK',
9298
'MENU',
9399
'METER',
94-
'MULTICOL', // Deprecated
100+
'MULTICOL', // Deprecated.
95101
'NAV',
96-
'NEXTID', // Deprecated
102+
'NEXTID', // Deprecated.
97103
'OL',
98104
'OUTPUT',
99105
'P',
@@ -106,7 +112,7 @@ public function data_single_tag_of_supported_elements() {
106112
'SECTION',
107113
'SLOT',
108114
'SMALL',
109-
'SPACER', // Deprecated
115+
'SPACER', // Deprecated.
110116
'SPAN',
111117
'STRIKE',
112118
'STRONG',

0 commit comments

Comments
 (0)