WP_HTML_Active_Formatting_Elements::remove_node
Removes a node from the stack of active formatting elements.
Method of the class: WP_HTML_Active_Formatting_Elements{}
No Hooks.
Returns
true|false. Whether the node was found and removed from the stack of active formatting elements.
Usage
$WP_HTML_Active_Formatting_Elements = new WP_HTML_Active_Formatting_Elements(); $WP_HTML_Active_Formatting_Elements->remove_node( $token );
- $token(WP_HTML_Token) (required)
- Remove this node from the stack, if it's there already.
Changelog
| Since 6.4.0 | Introduced. |
WP_HTML_Active_Formatting_Elements::remove_node() WP HTML Active Formatting Elements::remove node code WP 6.9
public function remove_node( WP_HTML_Token $token ) {
foreach ( $this->walk_up() as $position_from_end => $item ) {
if ( $token->bookmark_name !== $item->bookmark_name ) {
continue;
}
$position_from_start = $this->count() - $position_from_end - 1;
array_splice( $this->stack, $position_from_start, 1 );
return true;
}
return false;
}