Skip to content

Commit 8f3999a

Browse files
dmsnellsirreal
authored andcommitted
Update more tests, more checks, add SARCASM
1 parent 1bc2618 commit 8f3999a

4 files changed

Lines changed: 58 additions & 107 deletions

File tree

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -879,8 +879,6 @@ private function step_in_body() {
879879
* @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inbody
880880
*/
881881
switch ( $tag_name ) {
882-
case 'ABBR':
883-
case 'ACRONYM':
884882
case 'APPLET':
885883
case 'AREA':
886884
case 'BASE':
@@ -924,6 +922,7 @@ private function step_in_body() {
924922
case 'RP':
925923
case 'RT':
926924
case 'RTC':
925+
case 'SARCASM':
927926
case 'SCRIPT':
928927
case 'SELECT':
929928
case 'SOURCE':

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ public function data_unsupported_special_in_body_tags() {
199199
array( 'RP' ),
200200
array( 'RT' ),
201201
array( 'RTC' ),
202+
array( 'SARCASM' ),
202203
array( 'SCRIPT' ),
203204
array( 'SELECT' ),
204205
array( 'SOURCE' ),

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

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,26 @@ public function test_navigates_into_normative_html_for_supported_elements( $html
3737
public function data_single_tag_of_supported_elements() {
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+
'DEFN',
59+
'DEL',
4860
'DETAILS',
4961
'DIALOG',
5062
'DIR',
@@ -66,19 +78,42 @@ public function data_single_tag_of_supported_elements() {
6678
'HGROUP',
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

84119
$data = array();
@@ -121,28 +156,16 @@ public function test_fails_when_encountering_unsupported_tag( $html ) {
121156
*/
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',
148171
'FORM',
@@ -153,23 +176,13 @@ public function data_unsupported_elements() {
153176
'HTML',
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
175188
'NOFRAMES', // Neutralized
@@ -178,26 +191,16 @@ public function data_unsupported_elements() {
178191
'OL',
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',
203206
'TBODY',
@@ -207,13 +210,10 @@ public function data_unsupported_elements() {
207210
'TFOOT',
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.
219219
);

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

Lines changed: 21 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,14 @@ public function test_has_element_in_scope_needs_support() {
7272
$this->ensure_support_is_added_everywhere( 'OBJECT' );
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' );
75+
// MathML Elements.
76+
$this->ensure_support_is_added_everywhere( 'MATH' );
8277

8378
/*
8479
* SVG elements: note that TITLE is both an HTML element and an SVG element
8580
* so care must be taken when adding support for either one.
8681
*/
87-
$this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
88-
$this->ensure_support_is_added_everywhere( 'DESC' );
89-
$this->ensure_support_is_added_everywhere( 'TITLE' );
82+
$this->ensure_support_is_added_everywhere( 'SVG' );
9083
}
9184

9285
/**
@@ -115,21 +108,14 @@ public function test_has_element_in_list_item_scope_needs_support() {
115108
$this->ensure_support_is_added_everywhere( 'OBJECT' );
116109
$this->ensure_support_is_added_everywhere( 'TEMPLATE' );
117110

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' );
111+
// MathML Elements.
112+
$this->ensure_support_is_added_everywhere( 'MATH' );
125113

126114
/*
127115
* SVG elements: note that TITLE is both an HTML element and an SVG element
128116
* so care must be taken when adding support for either one.
129117
*/
130-
$this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
131-
$this->ensure_support_is_added_everywhere( 'DESC' );
132-
$this->ensure_support_is_added_everywhere( 'TITLE' );
118+
$this->ensure_support_is_added_everywhere( 'SVG' );
133119

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

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' );
150+
// MathML Elements.
151+
$this->ensure_support_is_added_everywhere( 'MATH' );
171152

172153
/*
173154
* SVG elements: note that TITLE is both an HTML element and an SVG element
174155
* so care must be taken when adding support for either one.
175156
*/
176-
$this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
177-
$this->ensure_support_is_added_everywhere( 'DESC' );
178-
$this->ensure_support_is_added_everywhere( 'TITLE' );
157+
$this->ensure_support_is_added_everywhere( 'SVG' );
179158
}
180159

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

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' );
183+
// MathML Elements.
184+
$this->ensure_support_is_added_everywhere( 'MATH' );
211185

212186
/*
213187
* SVG elements: note that TITLE is both an HTML element and an SVG element
214188
* so care must be taken when adding support for either one.
215189
*/
216-
$this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
217-
$this->ensure_support_is_added_everywhere( 'DESC' );
218-
$this->ensure_support_is_added_everywhere( 'TITLE' );
190+
$this->ensure_support_is_added_everywhere( 'SVG' );
219191
}
220192

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

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' );
216+
// MathML Elements.
217+
$this->ensure_support_is_added_everywhere( 'MATH' );
251218

252219
/*
253220
* SVG elements: note that TITLE is both an HTML element and an SVG element
254221
* so care must be taken when adding support for either one.
255222
*/
256-
$this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
257-
$this->ensure_support_is_added_everywhere( 'DESC' );
258-
$this->ensure_support_is_added_everywhere( 'TITLE' );
223+
$this->ensure_support_is_added_everywhere( 'SVG' );
259224
}
260225

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

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' );
248+
// MathML Elements.
249+
$this->ensure_support_is_added_everywhere( 'MATH' );
290250

291251
/*
292252
* SVG elements: note that TITLE is both an HTML element and an SVG element
293253
* so care must be taken when adding support for either one.
294254
*/
295-
$this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
296-
$this->ensure_support_is_added_everywhere( 'DESC' );
297-
$this->ensure_support_is_added_everywhere( 'TITLE' );
255+
$this->ensure_support_is_added_everywhere( 'SVG' );
298256

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

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' );
296+
// MathML Elements.
297+
$this->ensure_support_is_added_everywhere( 'MATH' );
345298

346299
/*
347300
* SVG elements: note that TITLE is both an HTML element and an SVG element
348301
* so care must be taken when adding support for either one.
349302
*/
350-
$this->ensure_support_is_added_everywhere( 'FOREIGNOBJECT' );
351-
$this->ensure_support_is_added_everywhere( 'DESC' );
352-
$this->ensure_support_is_added_everywhere( 'TITLE' );
303+
$this->ensure_support_is_added_everywhere( 'SVG' );
353304

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

0 commit comments

Comments
 (0)