- Timestamp:
- 05/24/2024 01:19:10 AM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/html-api/class-wp-html-processor.php
r58191 r58192 507 507 508 508 return false; 509 } 510 511 /** 512 * Indicates if the currently-matched node expects a closing 513 * token, or if it will self-close on the next step. 514 * 515 * Most HTML elements expect a closer, such as a P element or 516 * a DIV element. Others, like an IMG element are void and don't 517 * have a closing tag. Special elements, such as SCRIPT and STYLE, 518 * are treated just like void tags. Text nodes and self-closing 519 * foreign content will also act just like a void tag, immediately 520 * closing as soon as the processor advances to the next token. 521 * 522 * @since 6.6.0 523 * 524 * @todo When adding support for foreign content, ensure that 525 * this returns false for self-closing elements in the 526 * SVG and MathML namespace. 527 * 528 * @return bool Whether to expect a closer for the currently-matched node, 529 * or `null` if not matched on any token. 530 */ 531 public function expects_closer() { 532 $token_name = $this->get_token_name(); 533 if ( ! isset( $token_name ) ) { 534 return null; 535 } 536 537 return ! ( 538 // Comments, text nodes, and other atomic tokens. 539 '#' === $token_name[0] || 540 // Doctype declarations. 541 'html' === $token_name || 542 // Void elements. 543 self::is_void( $token_name ) || 544 // Special atomic elements. 545 in_array( $token_name, array( 'IFRAME', 'NOEMBED', 'NOFRAMES', 'SCRIPT', 'STYLE', 'TEXTAREA', 'TITLE', 'XMP' ), true ) 546 ); 509 547 } 510 548
Note: See TracChangeset
for help on using the changeset viewer.