File tree Expand file tree Collapse file tree
tests/phpunit/tests/html-api Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1498,6 +1498,7 @@ public function serialize_token(): string {
14981498
14991499 case 'SCRIPT ' :
15001500 case 'STYLE ' :
1501+ case 'XMP ' :
15011502 break ;
15021503
15031504 default :
Original file line number Diff line number Diff line change @@ -134,6 +134,19 @@ public function test_style_contents_are_not_escaped() {
134134 );
135135 }
136136
137+ /**
138+ * Ensures that XMP contents are not escaped, as they are not parsed like text nodes are.
139+ *
140+ * @ticket 62036
141+ */
142+ public function test_xmp_contents_are_not_escaped () {
143+ $ this ->assertSame (
144+ WP_HTML_Processor::normalize ( "<xmp>apples > or \x00anges & pears < plums</xmp> " ),
145+ "<xmp>apples > or \u{FFFD}anges & pears < plums</xmp> " ,
146+ 'Should have preserved text inside an XMP element, except for replacing NULL bytes. '
147+ );
148+ }
149+
137150 public function test_unexpected_closing_tags_are_removed () {
138151 $ this ->assertSame (
139152 WP_HTML_Processor::normalize ( 'one</div>two</span>three ' ),
@@ -493,6 +506,7 @@ public static function data_provider_normalized_fuzzer_cases_that_should_be_idem
493506 'FORM with SVG TITLE text edge ' => array ( "<form ><svg ><title \"'></form><form> " ),
494507 'FORM with TABLE and SCRIPT ' => array ( '<form id><table te"><script></script><td srce" ID/></form><form claslicate"> ' ),
495508 'FORM with TABLE CAPTION ' => array ( '<form><table><caption></form><form > ' ),
509+ 'XMP rawtext with entity-looking text ' => array ( '<xmp>apples > oranges & <</xmp> ' ),
496510 'Short malformed G attribute C ' => array ( '<g c/=> ' ),
497511 'Short malformed G attribute S ' => array ( '<g s/=> ' ),
498512 'Duplicate SRC boundary ' => array ( '<g src=""g src=""> ' ),
You can’t perform that action at this time.
0 commit comments