Indicates if the currently-matched node expects a closing token, or if it will self-close on the next step.
Description
Most HTML elements expect a closer, such as a P element or a DIV element. Others, like an IMG element are void and don’t have a closing tag. Special elements, such as SCRIPT and STYLE, are treated just like void tags. Text nodes and self-closing foreign content will also act just like a void tag, immediately closing as soon as the processor advances to the next token.
Parameters
$node
?WP_HTML_Tokenoptional- Node to examine instead of current node, if provided.
Default:
null
Source
/**
* Indicates if the current tag token is a tag closer.
*
* Example:
*
* $p = WP_HTML_Processor::create_fragment( '<div></div>' );
* $p->next_tag( array( 'tag_name' => 'div', 'tag_closers' => 'visit' ) );
* $p->is_tag_closer() === false;
*
* $p->next_tag( array( 'tag_name' => 'div', 'tag_closers' => 'visit' ) );
* $p->is_tag_closer() === true;
*
* @since 6.6.0 Subclassed for HTML Processor.
*
* @return bool Whether the current tag is a tag closer.
*/
public function is_tag_closer(): bool {
Changelog
Version | Description |
---|---|
6.6.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.