The manakai project

Web::DOM::ParentNode

The DOM ParentNode object

DESCRIPTION

The Web::DOM::ParentNode class implements the DOM ParentNode interface. The Web::DOM::ParentNode class is an abstract class. It is used as subclasses such as Web::DOM::Element and Web::DOM::Document.

METHODS

$col = $node->children

Return the Web::DOM::HTMLCollection containg the child elements of the node. [DOM]

$col = $node->get_elements_by_class_name ($class_names)

Return the Web::DOM::HTMLCollection containing the descendant elements which have all classes specified as the argument. The argument must be a space-separated list of class names. [DOM] [MANAKAI]

$col = $node->get_elements_by_tag_name ($tag_name)

Return the Web::DOM::HTMLCollection containing the descendant elements whose qualified name is equal to the argument. If the argument is *, all descendant elements are contained. [DOM] [MANAKAI]

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

Return the Web::DOM::HTMLCollection containing the descendant elements whose namespace URL and local name matching to the specified values. Both namespace URL and local name arguments can be *, which represents the wildcard. [DOM] [MANAKAI]

$node_list = $node->get_items ($types)

Return a Web::DOM::NodeList containing the elements creating top-level microdata items in the subtree rooted by the context object. If the argument is specified, only the elements creating items with specified types are returned. [HTML] [MANAKAI]

$number = $node->child_element_count

Return the number of child elements. [DOM]

$child = $node->first_element_child

Return the first element child of the node. If there is no such node, undef is returned. [DOM]

$node->inner_html ($string)
$string = $node->inner_html

Return or set the markup representation of the content of the node. [DOMPARSING] [HTML] [DOCUMENTINNERHTML] [MANAKAI]

If the document is an XML document and the given string is not well-formed, the method throws an exception.

However, even if the document is an XML document and the node can't be serialized into the well-formed XML fragment, the method does not throw and does return an ill-formed XML fragment instead. This is a willful violation to the HTML Living Standard, to match current browsers' behavior. Future version of the module might throw an exception if browsers start to throw an exception.

See also "DEPENDENCY" in Web::DOM.

$child = $node->last_element_child

Return the last element child of the node. If there is no such node, undef is returned. [DOM]

$element = $node->query_selector ($selectors, $resolver)

Return the first element identified by the group of selectors specified as the argument, if any, or undef. [SELECTORSAPI]

The optional second argument can specify the namespace resolver, i.e. a code reference or a Web::DOM::XPathNSResolver object. [NSRESOLVER] [DOMPERL]

For the list of supported Selectors features, see the documentation of the Web::CSS::Selectors::API module.

See also "DEPENDENCY" in Web::DOM.

$nodelist = $node->query_selector_all ($selectors, $resolver)

Return a static Web::DOM::NodeList containing the elements identified by the group of selectors specified as the argument. [SELECTORSAPI]

The optional second argument can specify the namespace resolver, i.e. a code reference or a Web::DOM::XPathNSResolver object. [NSRESOLVER] [DOMPERL]

For the list of supported Selectors features, see the documentation of the Web::CSS::Selectors::API module.

See also "DEPENDENCY" in Web::DOM.

SPECIFICATIONS

DOM

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

HTML

HTML Living Standard <http://www.whatwg.org/specs/web-apps/current-work/>.

DOMPARSING

DOM Parsing and Serialization <http://domparsing.spec.whatwg.org/>.

If the innerHTML attribute would mutate the children of the context object and the context object is an HTML template element, it must mutate the template content of the element instead.

DOCUMENTINNERHTML

Document innerHTML <http://html5.org/tools/web-apps-tracker?from=6531&to=6532>.

SELECTORSAPI

DOM Standard - Selectors API <https://github.com/whatwg/dom/pull/4/files>.

Selectors API Level 2 <http://dev.w3.org/2006/webapi/selectors-api2/>.

NSRESOLVER

Selectors API Editor's Draft 29 August 2007 <http://dev.w3.org/cvsweb/~checkout~/2006/webapi/selectors-api/Overview.html?rev=1.28&content-type=text/html;%20charset=utf-8>.

DOMPERL

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

MANAKAI

manakai's DOM Extensions <http://suika.suikawiki.org/~wakaba/wiki/sw/n/manakai++DOM%20Extensions>.

SEE ALSO

Web::DOM::Element, Web::DOM::Document, Web::DOM::DocumentFragment.

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.