Documentation

FrameTree
in package

Represents an entire document as a tree of frames

The FrameTree consists of objects each tied to specific DOMNode objects in a specific DomDocument. The FrameTree has the same structure as the DomDocument, but adds additional capabilities for styling and layout.

Table of Contents

$_absolute_frames  : array<string|int, mixed>
Subtrees of absolutely positioned elements
$_dom  : DOMDocument
The main DomDocument
$_registry  : array<string|int, mixed>
A mapping of {@link Frame} objects to DOMNode objects
$_root  : Frame
The root node of the FrameTree.
$HIDDEN_TAGS  : array<string|int, mixed>
Tags to ignore while parsing the tree
__construct()  : mixed
Class constructor
build_tree()  : mixed
Builds the tree
get_dom()  : DOMDocument
Returns the DOMDocument object representing the current html document
get_frame()  : Frame|null
Returns a specific frame given its id
get_frames()  : FrameTreeList|array<string|int, Frame>
Returns a post-order iterator for all frames in the tree
get_root()  : Frame
Returns the root frame of the tree
insert_node()  : mixed
_build_tree_r()  : Frame
Recursively adds {@link Frame} objects to the tree
_remove_node()  : mixed
Remove a child from a node
fix_tables()  : mixed
Adds missing TBODYs around TR

Properties

$_absolute_frames

Subtrees of absolutely positioned elements

protected array<string|int, mixed> $_absolute_frames

of Frames

$_registry

A mapping of {@link Frame} objects to DOMNode objects

protected array<string|int, mixed> $_registry

$HIDDEN_TAGS

Tags to ignore while parsing the tree

protected static array<string|int, mixed> $HIDDEN_TAGS = ["area", "base", "basefont", "head", "style", "meta", "title", "colgroup", "noembed", "param", "#comment"]

Methods

__construct()

Class constructor

public __construct(DOMDocument $dom) : mixed
Parameters
$dom : DOMDocument

the main DomDocument object representing the current html document

Return values
mixed

build_tree()

Builds the tree

public build_tree() : mixed
Return values
mixed

get_dom()

Returns the DOMDocument object representing the current html document

public get_dom() : DOMDocument
Return values
DOMDocument

get_frame()

Returns a specific frame given its id

public get_frame(string $id) : Frame|null
Parameters
$id : string
Return values
Frame|null

get_root()

Returns the root frame of the tree

public get_root() : Frame
Return values
Frame

insert_node()

public insert_node(DOMElement $node, DOMElement $new_node, string $pos) : mixed
Parameters
$node : DOMElement
$new_node : DOMElement
$pos : string
Return values
mixed

_build_tree_r()

Recursively adds {@link Frame} objects to the tree

protected _build_tree_r(DOMNode $node) : Frame

Recursively build a tree of Frame objects based on a dom tree. No layout information is calculated at this time, although the tree may be adjusted (i.e. nodes and frames for generated content and images may be created).

Parameters
$node : DOMNode

the current DOMNode being considered

Return values
Frame

_remove_node()

Remove a child from a node

protected _remove_node(DOMNode $node, array<string|int, mixed> &$children, int $index) : mixed

Remove a child from a node. If the removed node results in two adjacent #text nodes then combine them.

Parameters
$node : DOMNode

the current DOMNode being considered

$children : array<string|int, mixed>

an array of nodes that are the children of $node

$index : int

index from the $children array of the node to remove

Return values
mixed

fix_tables()

Adds missing TBODYs around TR

protected fix_tables() : mixed
Return values
mixed

Search results