NAME
Mojo::DOM::Node - DOM Node
SYNOPSIS
use Mojo::DOM::Node;
my $node = Mojo::DOM::Node->new(parent => $parent, tree => $tree);
say $node->content;
DESCRIPTION
Mojo::DOM::Node is a container for nodes used by Mojo::DOM.
ATTRIBUTES
Mojo::DOM::Node implements the following attributes.
parent
my $parent = $node->parent;
$node = $node->parent(Mojo::DOM->new);
Mojo::DOM object for parent of this node.
tree
my $tree = $node->tree;
$node = $node->tree(['text', 'foo']);
Document Object Model. Note that this structure should only be used very carefully since it is very dynamic.
METHODS
Mojo::DOM::Node inherits all methods from Mojo::Base and implements the following new ones.
content
my $content = $node->content;
$node = $node->content('foo');
Return or replace this node's content.
node
my $type = $node->node;
This node's type, usually cdata
, comment
, doctype
, pi
, raw
or text
.
remove
my $parent = $node->remove;
Remove this node and return "parent".
OPERATORS
Mojo::DOM::Node overloads the following operators.
bool
my $bool = !!$node;
Always true.
stringify
my $content = "$node";
Alias for "content".