The manakai project

Web::DOM::HTMLCollection

The DOM HTMLCollection object

DESCRIPTION

The Web::DOM::HTMLCollection class implements the DOM HTMLCollection interface.

METHODS

Following methods are available:

$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 Perl-ish ways to access items, such as negative indexing, while $col->[-1] works as intended.

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

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

$node = $col->{$key}
$node = $col->named_item ($key)

Return the node whose ID or the name attribute is equal to the argument, if any, or undef. [DOM]

The method does not examine the name attribute of the elements whose namespace is different from the HTML namespace. This is a willful violation to the DOM Standard for consistency with the named properties and compatibility with browsers.

$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]. [DOMPERL]

SPECIFICATIONS

DOM

DOM Living Standard <http://dom.spec.whatwg.org/#interface-htmlcollection>.

DOMPERL

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

SEE ALSO

Web::DOM::Node, Web::DOM::NodeList.

AUTHOR

Wakaba <wakaba@suikawiki.org>.

LICENSE

Copyright 2012 Wakaba <wakaba@suikawiki.org>.

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