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 @@ -1593,6 +1593,7 @@ public function serialize_token(): string {
15931593
15941594 case 'SCRIPT ' :
15951595 case 'STYLE ' :
1596+ case 'XMP ' :
15961597 break ;
15971598
15981599 default :
Original file line number Diff line number Diff line change @@ -257,6 +257,19 @@ public function test_style_contents_are_not_escaped() {
257257 );
258258 }
259259
260+ /**
261+ * Ensures that XMP contents are not escaped, as they are not parsed like text nodes are.
262+ *
263+ * @ticket 62036
264+ */
265+ public function test_xmp_contents_are_not_escaped () {
266+ $ this ->assertSame (
267+ WP_HTML_Processor::normalize ( "<xmp>apples > or \x00anges & pears < plums</xmp> " ),
268+ "<xmp>apples > or \u{FFFD}anges & pears < plums</xmp> " ,
269+ 'Should have preserved text inside an XMP element, except for replacing NULL bytes. '
270+ );
271+ }
272+
260273 public function test_unexpected_closing_tags_are_removed () {
261274 $ this ->assertSame (
262275 WP_HTML_Processor::normalize ( 'one</div>two</span>three ' ),
@@ -616,6 +629,7 @@ public static function data_provider_normalized_fuzzer_cases_that_should_be_idem
616629 'FORM with SVG TITLE text edge ' => array ( "<form ><svg ><title \"'></form><form> " ),
617630 'FORM with TABLE and SCRIPT ' => array ( '<form id><table te"><script></script><td srce" ID/></form><form claslicate"> ' ),
618631 'FORM with TABLE CAPTION ' => array ( '<form><table><caption></form><form > ' ),
632+ 'XMP rawtext with entity-looking text ' => array ( '<xmp>apples > oranges & <</xmp> ' ),
619633 'Short malformed G attribute C ' => array ( '<g c/=> ' ),
620634 'Short malformed G attribute S ' => array ( '<g s/=> ' ),
621635 'Duplicate SRC boundary ' => array ( '<g src=""g src=""> ' ),
You can’t perform that action at this time.
0 commit comments