WP_HTML_Active_Formatting_Elements::walk_up()
Steps through the stack of active formatting elements, starting with the bottom element (added last) and walking upwards to the one added first.
This generator function is designed to be used inside a "foreach" loop.
Example:
$html = '<em><strong><a>We are here'; foreach ( $stack->walk_up() as $node ) { echo "{$node->node_name} -> "; } > A -> STRONG -> EM ->
To start with the first added element and walk towards the bottom, see WP_HTML_Active_Formatting_Elements::walk_down().
Method of the class: WP_HTML_Active_Formatting_Elements{}
No Hooks.
Return
null
. Nothing (null).
Usage
$WP_HTML_Active_Formatting_Elements = new WP_HTML_Active_Formatting_Elements(); $WP_HTML_Active_Formatting_Elements->walk_up();
Changelog
Since 6.4.0 | Introduced. |
WP_HTML_Active_Formatting_Elements::walk_up() WP HTML Active Formatting Elements::walk up code WP 6.6.2
public function walk_up() { for ( $i = count( $this->stack ) - 1; $i >= 0; $i-- ) { yield $this->stack[ $i ]; } }