Inserts a virtual element on the stack of open elements.
Parameters
$token_namestringrequired- Name of token to create and insert into the stack of open elements.
$bookmark_namestring|nulloptional- Name to give bookmark for created virtual node.
Defaults to auto-creating a bookmark name.Default:
null
Source
private function insert_virtual_node( $token_name, $bookmark_name = null ): WP_HTML_Token {
$here = $this->bookmarks[ $this->state->current_token->bookmark_name ];
$name = $bookmark_name ?? $this->bookmark_token();
$this->bookmarks[ $name ] = new WP_HTML_Span( $here->start, 0 );
$token = new WP_HTML_Token( $name, $token_name, false );
$this->insert_html_element( $token );
return $token;
}
Changelog
| Version | Description |
|---|---|
| 6.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.