Skip to content

Commit bf356f0

Browse files
committed
Remove addition of extra tags in this PR.
1 parent d57744f commit bf356f0

4 files changed

Lines changed: 43 additions & 57 deletions

File tree

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

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,18 +1276,6 @@ private function step_in_body() {
12761276
$this->run_adoption_agency_algorithm();
12771277
return true;
12781278

1279-
/*
1280-
* > A start tag whose tag name is one of: "applet", "marquee", "object"
1281-
*/
1282-
case '+APPLET':
1283-
case '+MARQUEE':
1284-
case '+OBJECT':
1285-
$this->reconstruct_active_formatting_elements();
1286-
$this->insert_html_element( $this->state->current_token );
1287-
$this->state->active_formatting_elements->insert_marker();
1288-
$this->state->frameset_ok = false;
1289-
return true;
1290-
12911279
/*
12921280
* > An end tag whose tag name is "br"
12931281
* > Parse error. Drop the attributes from the token, and act as described in the next
@@ -1348,41 +1336,6 @@ private function step_in_body() {
13481336
case '+TRACK':
13491337
$this->insert_html_element( $this->state->current_token );
13501338
return true;
1351-
1352-
/*
1353-
* > A start tag whose tag name is "textarea"
1354-
*/
1355-
case '+TEXTAREA':
1356-
$this->insert_html_element( $this->state->current_token );
1357-
$this->state->frameset_ok = false;
1358-
return true;
1359-
1360-
/*
1361-
* > A start tag whose tag name is "xmp"
1362-
*/
1363-
case '+XMP':
1364-
if ( $this->state->stack_of_open_elements->has_p_in_button_scope() ) {
1365-
$this->close_a_p_element();
1366-
}
1367-
$this->reconstruct_active_formatting_elements();
1368-
$this->insert_html_element( $this->state->current_token );
1369-
$this->state->frameset_ok = false;
1370-
return true;
1371-
1372-
/*
1373-
* > A start tag whose tag name is "iframe"
1374-
*/
1375-
case '+IFRAME':
1376-
$this->insert_html_element( $this->state->current_token );
1377-
$this->state->frameset_ok = false;
1378-
return true;
1379-
1380-
/*
1381-
* > A start tag whose tag name is "noembed"
1382-
*/
1383-
case '+NOEMBED':
1384-
$this->insert_html_element( $this->state->current_token );
1385-
return true;
13861339
}
13871340

13881341
/*
@@ -1402,6 +1355,7 @@ private function step_in_body() {
14021355
* @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inbody
14031356
*/
14041357
switch ( $token_name ) {
1358+
case 'APPLET':
14051359
case 'BASE':
14061360
case 'BASEFONT':
14071361
case 'BGSOUND':
@@ -1414,12 +1368,16 @@ private function step_in_body() {
14141368
case 'FRAMESET':
14151369
case 'HEAD':
14161370
case 'HTML':
1371+
case 'IFRAME':
14171372
case 'LINK':
1373+
case 'MARQUEE':
14181374
case 'MATH':
14191375
case 'META':
14201376
case 'NOBR':
1377+
case 'NOEMBED':
14211378
case 'NOFRAMES':
14221379
case 'NOSCRIPT':
1380+
case 'OBJECT':
14231381
case 'OPTGROUP':
14241382
case 'OPTION':
14251383
case 'PLAINTEXT':
@@ -1436,11 +1394,13 @@ private function step_in_body() {
14361394
case 'TBODY':
14371395
case 'TD':
14381396
case 'TEMPLATE':
1397+
case 'TEXTAREA':
14391398
case 'TFOOT':
14401399
case 'TH':
14411400
case 'THEAD':
14421401
case 'TITLE':
14431402
case 'TR':
1403+
case 'XMP':
14441404
$this->last_error = self::ERROR_UNSUPPORTED;
14451405
throw new WP_HTML_Unsupported_Exception( "Cannot process {$token_name} element." );
14461406
}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ public function test_step_in_body_fails_on_unsupported_tags( $tag_name ) {
388388
*/
389389
public static function data_unsupported_special_in_body_tags() {
390390
return array(
391+
'APPLET' => array( 'APPLET' ),
391392
'BASE' => array( 'BASE' ),
392393
'BASEFONT' => array( 'BASEFONT' ),
393394
'BGSOUND' => array( 'BGSOUND' ),
@@ -400,12 +401,16 @@ public static function data_unsupported_special_in_body_tags() {
400401
'FRAMESET' => array( 'FRAMESET' ),
401402
'HEAD' => array( 'HEAD' ),
402403
'HTML' => array( 'HTML' ),
404+
'IFRAME' => array( 'IFRAME' ),
403405
'LINK' => array( 'LINK' ),
406+
'MARQUEE' => array( 'MARQUEE' ),
404407
'MATH' => array( 'MATH' ),
405408
'META' => array( 'META' ),
406409
'NOBR' => array( 'NOBR' ),
410+
'NOEMBED' => array( 'NOEMBED' ),
407411
'NOFRAMES' => array( 'NOFRAMES' ),
408412
'NOSCRIPT' => array( 'NOSCRIPT' ),
413+
'OBJECT' => array( 'OBJECT' ),
409414
'OPTGROUP' => array( 'OPTGROUP' ),
410415
'OPTION' => array( 'OPTION' ),
411416
'PLAINTEXT' => array( 'PLAINTEXT' ),
@@ -422,11 +427,13 @@ public static function data_unsupported_special_in_body_tags() {
422427
'TBODY' => array( 'TBODY' ),
423428
'TD' => array( 'TD' ),
424429
'TEMPLATE' => array( 'TEMPLATE' ),
430+
'TEXTAREA' => array( 'TEXTAREA' ),
425431
'TFOOT' => array( 'TFOOT' ),
426432
'TH' => array( 'TH' ),
427433
'THEAD' => array( 'THEAD' ),
428434
'TITLE' => array( 'TITLE' ),
429435
'TR' => array( 'TR' ),
436+
'XMP' => array( 'XMP' ),
430437
);
431438
}
432439

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public static function data_single_tag_of_supported_elements() {
4040
'ABBR',
4141
'ACRONYM', // Neutralized.
4242
'ADDRESS',
43-
'APPLET', // Deprecated.
4443
'AREA',
4544
'ARTICLE',
4645
'ASIDE',
@@ -86,28 +85,25 @@ public static function data_single_tag_of_supported_elements() {
8685
'I',
8786
'IMG',
8887
'INS',
88+
'LI',
8989
'ISINDEX', // Deprecated.
9090
'KBD',
9191
'KEYGEN', // Deprecated.
9292
'LABEL',
9393
'LEGEND',
94-
'LI',
9594
'LISTING', // Deprecated.
9695
'MAIN',
9796
'MAP',
9897
'MARK',
99-
'MARQUEE', // Deprecated.
10098
'MENU',
10199
'METER',
102100
'MULTICOL', // Deprecated.
103101
'NAV',
104102
'NEXTID', // Deprecated.
105-
'OBJECT',
106103
'OL',
107104
'OUTPUT',
108105
'P',
109106
'PICTURE',
110-
'PRE',
111107
'PROGRESS',
112108
'Q',
113109
'RUBY',
@@ -129,19 +125,14 @@ public static function data_single_tag_of_supported_elements() {
129125
'UL',
130126
'VAR',
131127
'VIDEO',
132-
'WBR',
133128
);
134129

135130
$data = array();
136131
foreach ( $supported_elements as $tag_name ) {
137132
$data[ $tag_name ] = array( "<{$tag_name}>", $tag_name );
138133
}
139134

140-
$data['IFRAME'] = array( '<iframe></iframe>', 'IFRAME' );
141135
$data['IMAGE (treated as an IMG)'] = array( '<image>', 'IMG' );
142-
$data['NOEMBED'] = array( '<noembed></noembed>', 'NOEMBED' ); // Neutralized.
143-
$data['TEXTAREA'] = array( '<textarea></textarea>', 'TEXTAREA' );
144-
$data['XMP'] = array( '<xmp></xmp>', 'XMP' ); // Deprecated, use PRE instead.
145136

146137
return $data;
147138
}
@@ -176,6 +167,7 @@ public function test_fails_when_encountering_unsupported_tag( $html ) {
176167
*/
177168
public static function data_unsupported_elements() {
178169
$unsupported_elements = array(
170+
'APPLET', // Deprecated.
179171
'BASE',
180172
'BGSOUND', // Deprecated; self-closing if self-closing flag provided, otherwise normal.
181173
'BODY',
@@ -187,12 +179,16 @@ public static function data_unsupported_elements() {
187179
'FRAMESET',
188180
'HEAD',
189181
'HTML',
182+
'IFRAME',
190183
'LINK',
184+
'MARQUEE', // Deprecated.
191185
'MATH',
192186
'META',
193187
'NOBR', // Neutralized.
188+
'NOEMBED', // Neutralized.
194189
'NOFRAMES', // Neutralized.
195190
'NOSCRIPT',
191+
'OBJECT',
196192
'OPTGROUP',
197193
'OPTION',
198194
'PLAINTEXT', // Neutralized.
@@ -208,11 +204,13 @@ public static function data_unsupported_elements() {
208204
'TBODY',
209205
'TD',
210206
'TEMPLATE',
207+
'TEXTAREA',
211208
'TFOOT',
212209
'TH',
213210
'THEAD',
214211
'TITLE',
215212
'TR',
213+
'XMP', // Deprecated, use PRE instead.
216214
);
217215

218216
$data = array();

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,14 @@ private function ensure_support_is_added_everywhere( $tag_name ) {
6262
*/
6363
public function test_has_element_in_scope_needs_support() {
6464
// These elements impact all scopes.
65+
$this->ensure_support_is_added_everywhere( 'APPLET' );
6566
$this->ensure_support_is_added_everywhere( 'CAPTION' );
6667
$this->ensure_support_is_added_everywhere( 'HTML' );
6768
$this->ensure_support_is_added_everywhere( 'TABLE' );
6869
$this->ensure_support_is_added_everywhere( 'TD' );
6970
$this->ensure_support_is_added_everywhere( 'TH' );
71+
$this->ensure_support_is_added_everywhere( 'MARQUEE' );
72+
$this->ensure_support_is_added_everywhere( 'OBJECT' );
7073
$this->ensure_support_is_added_everywhere( 'TEMPLATE' );
7174

7275
// MathML Elements: MI, MO, MN, MS, MTEXT, ANNOTATION-XML.
@@ -97,11 +100,14 @@ public function test_has_element_in_scope_needs_support() {
97100
*/
98101
public function test_has_element_in_list_item_scope_needs_support() {
99102
// These elements impact all scopes.
103+
$this->ensure_support_is_added_everywhere( 'APPLET' );
100104
$this->ensure_support_is_added_everywhere( 'CAPTION' );
101105
$this->ensure_support_is_added_everywhere( 'HTML' );
102106
$this->ensure_support_is_added_everywhere( 'TABLE' );
103107
$this->ensure_support_is_added_everywhere( 'TD' );
104108
$this->ensure_support_is_added_everywhere( 'TH' );
109+
$this->ensure_support_is_added_everywhere( 'MARQUEE' );
110+
$this->ensure_support_is_added_everywhere( 'OBJECT' );
105111
$this->ensure_support_is_added_everywhere( 'TEMPLATE' );
106112

107113
// MathML Elements: MI, MO, MN, MS, MTEXT, ANNOTATION-XML.
@@ -128,11 +134,14 @@ public function test_has_element_in_list_item_scope_needs_support() {
128134
*/
129135
public function test_has_element_in_button_scope_needs_support() {
130136
// These elements impact all scopes.
137+
$this->ensure_support_is_added_everywhere( 'APPLET' );
131138
$this->ensure_support_is_added_everywhere( 'CAPTION' );
132139
$this->ensure_support_is_added_everywhere( 'HTML' );
133140
$this->ensure_support_is_added_everywhere( 'TABLE' );
134141
$this->ensure_support_is_added_everywhere( 'TD' );
135142
$this->ensure_support_is_added_everywhere( 'TH' );
143+
$this->ensure_support_is_added_everywhere( 'MARQUEE' );
144+
$this->ensure_support_is_added_everywhere( 'OBJECT' );
136145
$this->ensure_support_is_added_everywhere( 'TEMPLATE' );
137146

138147
// MathML Elements: MI, MO, MN, MS, MTEXT, ANNOTATION-XML.
@@ -160,11 +169,14 @@ public function test_has_element_in_button_scope_needs_support() {
160169
*/
161170
public function test_after_element_pop_must_maintain_p_in_button_scope_flag() {
162171
// These elements impact all scopes.
172+
$this->ensure_support_is_added_everywhere( 'APPLET' );
163173
$this->ensure_support_is_added_everywhere( 'CAPTION' );
164174
$this->ensure_support_is_added_everywhere( 'HTML' );
165175
$this->ensure_support_is_added_everywhere( 'TABLE' );
166176
$this->ensure_support_is_added_everywhere( 'TD' );
167177
$this->ensure_support_is_added_everywhere( 'TH' );
178+
$this->ensure_support_is_added_everywhere( 'MARQUEE' );
179+
$this->ensure_support_is_added_everywhere( 'OBJECT' );
168180
$this->ensure_support_is_added_everywhere( 'TEMPLATE' );
169181

170182
// MathML Elements: MI, MO, MN, MS, MTEXT, ANNOTATION-XML.
@@ -192,11 +204,14 @@ public function test_after_element_pop_must_maintain_p_in_button_scope_flag() {
192204
*/
193205
public function test_after_element_push_must_maintain_p_in_button_scope_flag() {
194206
// These elements impact all scopes.
207+
$this->ensure_support_is_added_everywhere( 'APPLET' );
195208
$this->ensure_support_is_added_everywhere( 'CAPTION' );
196209
$this->ensure_support_is_added_everywhere( 'HTML' );
197210
$this->ensure_support_is_added_everywhere( 'TABLE' );
198211
$this->ensure_support_is_added_everywhere( 'TD' );
199212
$this->ensure_support_is_added_everywhere( 'TH' );
213+
$this->ensure_support_is_added_everywhere( 'MARQUEE' );
214+
$this->ensure_support_is_added_everywhere( 'OBJECT' );
200215
$this->ensure_support_is_added_everywhere( 'TEMPLATE' );
201216

202217
// MathML Elements: MI, MO, MN, MS, MTEXT, ANNOTATION-XML.
@@ -223,11 +238,14 @@ public function test_after_element_push_must_maintain_p_in_button_scope_flag() {
223238
*/
224239
public function test_has_element_in_table_scope_needs_support() {
225240
// These elements impact all scopes.
241+
$this->ensure_support_is_added_everywhere( 'APPLET' );
226242
$this->ensure_support_is_added_everywhere( 'CAPTION' );
227243
$this->ensure_support_is_added_everywhere( 'HTML' );
228244
$this->ensure_support_is_added_everywhere( 'TABLE' );
229245
$this->ensure_support_is_added_everywhere( 'TD' );
230246
$this->ensure_support_is_added_everywhere( 'TH' );
247+
$this->ensure_support_is_added_everywhere( 'MARQUEE' );
248+
$this->ensure_support_is_added_everywhere( 'OBJECT' );
231249
$this->ensure_support_is_added_everywhere( 'TEMPLATE' );
232250

233251
// MathML Elements: MI, MO, MN, MS, MTEXT, ANNOTATION-XML.
@@ -270,11 +288,14 @@ public function test_has_element_in_table_scope_needs_support() {
270288
*/
271289
public function test_has_element_in_select_scope_needs_support() {
272290
// These elements impact all scopes.
291+
$this->ensure_support_is_added_everywhere( 'APPLET' );
273292
$this->ensure_support_is_added_everywhere( 'CAPTION' );
274293
$this->ensure_support_is_added_everywhere( 'HTML' );
275294
$this->ensure_support_is_added_everywhere( 'TABLE' );
276295
$this->ensure_support_is_added_everywhere( 'TD' );
277296
$this->ensure_support_is_added_everywhere( 'TH' );
297+
$this->ensure_support_is_added_everywhere( 'MARQUEE' );
298+
$this->ensure_support_is_added_everywhere( 'OBJECT' );
278299
$this->ensure_support_is_added_everywhere( 'TEMPLATE' );
279300

280301
// MathML Elements: MI, MO, MN, MS, MTEXT, ANNOTATION-XML.

0 commit comments

Comments
 (0)