Steps through the stack of active formatting elements, starting with the bottom element (added last) and walking upwards to the one added first.
Description
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().
Source
public function walk_up() {
for ( $i = count( $this->stack ) - 1; $i >= 0; $i-- ) {
yield $this->stack[ $i ];
}
}
Changelog
Version | Description |
---|---|
6.4.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.