The manakai project

Web::DOM::NamedNodeMap

DOM NamedNodeMap object

DESCRIPTION

The Web::DOM::NamedNodeMap class implements the DOM NamedNodeMap interface, i.e. it represents the list of the content attributes of an element.

METHODS

Following methods are available:

$node = $col->{$name}
$node = $col->get_named_item ($name)

Return the first node in the list whose name is equal to the argument. [DOM] [DOMPERL]

$node = $col->get_named_item_ns ($nsurl, $local_name)

Return the node in the list whose namespace URL and local name are equal to the arguments. [DOM]

This method is only applicable to the attributes collection. [DOMDTDEF]

$node = $col->[$index]
$node = $col->item ($index)

Return the node in the collection, specified by its index. [DOM] [DOMPERL]

Use of the item method is discouraged as it doesn't support Perlish ways to access items, such as negative indexing, while $col->[-1] works as you intended.

$number = @$col
$number = keys %$col
$number = $col->length

Return the number of the nodes in the collection. [DOM] [DOMPERL]

$node = $col->remove_named_item ($name)

Remove the first node in the list whose name is equal to the argument. The removed node is returned. [DOM]

$node = $col->remove_named_item_ns ($nsurl, $local_name)

Remove the node in the list whose namespace URL and local name are equal to the arguments. The removed node is returned. [DOM]

This method is only applicable to the attributes collection. [DOMDTDEF]

$node = $col->set_named_item ($node)
$node = $col->set_named_item_ns ($node)

Add the specified node to the list. If there is already a node with same name in the list, the node is removed from the list and is returned. Otherwise undef is returned. [DOM]

The set_named_item_ns method is only applicable to the attributes collection. [DOMDTDEF]

$arrayref = $col->to_a

Return the new static array reference containing the nodes in the collection. [DOMPERL]

($node1, $node2, ...) = $col->to_list
($node1, $node2, ...) = @$col

Return the list of the nodes contained in the collection. [DOMPERL]

The object supports Perl standard read-only operations for array references, e.g. exists $col->[4] or for hash references, e.g. exists $col->{class}. [DOMPERL]

SPECIFICATIONS

DOM

DOM Standard <https://dom.spec.whatwg.org/>.

DOM3CORE

Document Object Model (DOM) Level 3 Core Specification <https://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/DOM3-Core.html#core-ID-1780488922>.

DOMDTDEF

DOM Document Type Definitions <https://suika.suikawiki.org/www/markup/xml/domdtdef/domdtdef>.

DOMPERL

manakai's DOM Perl Binding <https://suika.suikawiki.org/~wakaba/wiki/sw/n/manakai%27s%20DOM%20Perl%20Binding#anchor-86>.

MANAKAI

manakai DOM Extensions <https://suika.suikawiki.org/~wakaba/wiki/sw/n/manakai%20DOM%20Extensions>.

SEE ALSO

Web::DOM::Node, Web::DOM::Element, Web::DOM::Attr.

AUTHOR

Wakaba <wakaba@suikawiki.org>.

LICENSE

Copyright 2012-2016 Wakaba <wakaba@suikawiki.org>.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.