Changeset 59411
- Timestamp:
- 11/18/2024 01:37:52 PM (3 months ago)
- Location:
- branches/6.7
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.7
-
branches/6.7/src/wp-includes/html-api/class-wp-html-processor.php
r59401 r59411 1171 1171 1172 1172 if ( null !== $doctype->public_identifier ) { 1173 $html .= " PUBLIC \"{$doctype->public_identifier}\""; 1173 $quote = str_contains( $doctype->public_identifier, '"' ) ? "'" : '"'; 1174 $html .= " PUBLIC {$quote}{$doctype->public_identifier}{$quote}"; 1174 1175 } 1175 1176 if ( null !== $doctype->system_identifier ) { … … 1177 1178 $html .= ' SYSTEM'; 1178 1179 } 1179 $html .= " \"{$doctype->system_identifier}\""; 1180 } 1180 $quote = str_contains( $doctype->system_identifier, '"' ) ? "'" : '"'; 1181 $html .= " {$quote}{$doctype->system_identifier}{$quote}"; 1182 } 1183 1181 1184 $html .= '>'; 1182 1185 break; -
branches/6.7/tests/phpunit/tests/html-api/wpHtmlProcessor-serialize.php
r59401 r59411 308 308 public static function data_provider_serialize_doctype() { 309 309 return array( 310 'None' => array( '', '' ), 311 'Empty' => array( '<!DOCTYPE>', '<!DOCTYPE>' ), 312 'HTML5' => array( '<!DOCTYPE html>', '<!DOCTYPE html>' ), 313 'Strange name' => array( '<!DOCTYPE WordPress>', '<!DOCTYPE wordpress>' ), 314 'With public' => array( '<!DOCTYPE html PUBLIC "x">', '<!DOCTYPE html PUBLIC "x">' ), 315 'With system' => array( '<!DOCTYPE html SYSTEM "y">', '<!DOCTYPE html SYSTEM "y">' ), 316 'With public and system' => array( '<!DOCTYPE html PUBLIC "x" "y">', '<!DOCTYPE html PUBLIC "x" "y">' ), 317 'Weird casing' => array( '<!docType HtmL pubLIc\'xxx\'"yyy" all this is ignored>', '<!DOCTYPE html PUBLIC "xxx" "yyy">' ), 310 'None' => array( '', '' ), 311 'Empty' => array( '<!DOCTYPE>', '<!DOCTYPE>' ), 312 'HTML5' => array( '<!DOCTYPE html>', '<!DOCTYPE html>' ), 313 'Strange name' => array( '<!DOCTYPE WordPress>', '<!DOCTYPE wordpress>' ), 314 'With public' => array( '<!DOCTYPE html PUBLIC "x">', '<!DOCTYPE html PUBLIC "x">' ), 315 'With system' => array( '<!DOCTYPE html SYSTEM "y">', '<!DOCTYPE html SYSTEM "y">' ), 316 'With public and system' => array( '<!DOCTYPE html PUBLIC "x" "y">', '<!DOCTYPE html PUBLIC "x" "y">' ), 317 'Weird casing' => array( '<!docType HtmL pubLIc\'xxx\'"yyy" all this is ignored>', '<!DOCTYPE html PUBLIC "xxx" "yyy">' ), 318 'Single quotes in public ID' => array( '<!DOCTYPE html PUBLIC "\'quoted\'">', '<!DOCTYPE html PUBLIC "\'quoted\'">' ), 319 'Double quotes in public ID' => array( '<!DOCTYPE html PUBLIC \'"quoted"\'\>', '<!DOCTYPE html PUBLIC \'"quoted"\'>' ), 320 'Single quotes in system ID' => array( '<!DOCTYPE html SYSTEM "\'quoted\'">', '<!DOCTYPE html SYSTEM "\'quoted\'">' ), 321 'Double quotes in system ID' => array( '<!DOCTYPE html SYSTEM \'"quoted"\'\>', '<!DOCTYPE html SYSTEM \'"quoted"\'>' ), 318 322 ); 319 323 }
Note: See TracChangeset
for help on using the changeset viewer.