[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/html-api/ -> class-wp-html-active-formatting-elements.php (summary)

HTML API: WP_HTML_Active_Formatting_Elements class

File Size: 187 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_HTML_Active_Formatting_Elements:: (7 methods):
  contains_node()
  count()
  current_node()
  push()
  remove_node()
  walk_down()
  walk_up()


Class: WP_HTML_Active_Formatting_Elements  - X-Ref

Core class used by the HTML processor during HTML parsing
for managing the stack of active formatting elements.

This class is designed for internal use by the HTML processor.

> Initially, the list of active formatting elements is empty.
> It is used to handle mis-nested formatting element tags.
>
> The list contains elements in the formatting category, and markers.
> The markers are inserted when entering applet, object, marquee,
> template, td, th, and caption elements, and are used to prevent
> formatting from "leaking" into applet, object, marquee, template,
> td, th, and caption elements.
>
> In addition, each element in the list of active formatting elements
> is associated with the token for which it was created, so that
> further elements can be created for that token if necessary.

contains_node( $token )   X-Ref
Reports if a specific node is in the stack of active formatting elements.

return: bool Whether the referenced node is in the stack of active formatting elements.
param: WP_HTML_Token $token Look for this node in the stack.

count()   X-Ref
Returns how many nodes are currently in the stack of active formatting elements.

return: int How many node are in the stack of active formatting elements.

current_node()   X-Ref
Returns the node at the end of the stack of active formatting elements,
if one exists. If the stack is empty, returns null.

return: WP_HTML_Token|null Last node in the stack of active formatting elements, if one exists, otherwise null.

push( $token )   X-Ref
Pushes a node onto the stack of active formatting elements.

param: WP_HTML_Token $token Push this node onto the stack.

remove_node( $token )   X-Ref
Removes a node from the stack of active formatting elements.

return: bool Whether the node was found and removed from the stack of active formatting elements.
param: WP_HTML_Token $token Remove this node from the stack, if it's there already.

walk_down()   X-Ref
Steps through the stack of active formatting elements, starting with the
top element (added first) and walking downwards to the one added last.

This generator function is designed to be used inside a "foreach" loop.

Example:

$html = '<em><strong><a>We are here';
foreach ( $stack->walk_down() as $node ) {
echo "{$node->node_name} -> ";
}
> EM -> STRONG -> A ->

To start with the most-recently added element and walk towards the top,
see WP_HTML_Active_Formatting_Elements::walk_up().


walk_up()   X-Ref
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().




Generated : Sun Apr 28 08:20:02 2024 Cross-referenced by PHPXref