<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">NAME
    HTML5::DOM &lt;https://metacpan.org/pod/HTML5::DOM&gt; - Super fast html5 DOM
    library with css selectors (based on Modest/MyHTML)

SYNOPSIS
     use warnings;
     use strict;
     use HTML5::DOM;

     # create parser object
     my $parser = HTML5::DOM-&gt;new;

     # parse some html
     my $tree = $parser-&gt;parse('
      &lt;label&gt;Some list of OS:&lt;/label&gt;
      &lt;ul class="list" data-what="os" title="OS list"&gt;
         &lt;li&gt;UNIX&lt;/li&gt;
         &lt;li&gt;Linux&lt;/li&gt;
         &lt;!-- comment --&gt;
         &lt;li&gt;OSX&lt;/li&gt;
         &lt;li&gt;Windows&lt;/li&gt;
         &lt;li&gt;FreeBSD&lt;/li&gt;
      &lt;/ul&gt;
     ');

     # find one element by CSS selector
     my $ul = $tree-&gt;at('ul.list');

     # prints tag
     print $ul-&gt;tag."\n"; # ul

     # check if &lt;ul&gt; has class list
     print "&lt;ul&gt; has class .list\n" if ($ul-&gt;classList-&gt;has('list'));

     # add some class
     $ul-&gt;classList-&gt;add('os-list');

     # prints &lt;ul&gt; classes
     print $ul-&gt;className."\n"; # list os-list

     # prints &lt;ul&gt; attribute title
     print $ul-&gt;attr("title")."\n"; # OS list

     # changing &lt;ul&gt; attribute title
     $ul-&gt;attr("title", "OS names list");

     # find all os names
     $ul-&gt;find('li')-&gt;each(sub {
      my ($node, $index) = @_;
      print "OS #$index: ".$node-&gt;text."\n";
     });

     # we can use precompiled selectors
     my $css_parser = HTML5::DOM::CSS-&gt;new;
     my $selector = $css_parser-&gt;parseSelector('li');

     # remove OSX from OS
     $ul-&gt;find($selector)-&gt;[2]-&gt;remove();

     # serialize tree
     print $tree-&gt;html."\n";
 
     # TODO: more examples in SYNOPSIS
     # But you can explore API documentation.
     # My lib have simple API, which is intuitively familiar to anyone who used the DOM.

DESCRIPTION
    HTML5::DOM &lt;https://metacpan.org/pod/HTML5::DOM&gt; is a fast HTML5 parser
    and DOM manipulatin library with CSS4 selectors, fully conformant with
    the HTML5 specification.

    It based on &lt;https://github.com/lexborisov/Modest&gt; as selector engine
    and &lt;https://github.com/lexborisov/myhtml&gt; as HTML5 parser.

   Key features
    *   Really fast HTML parsing.

    *   Supports parsing by chunks.

    *   Fully conformant with the HTML5 specification.

    *   Fast CSS4 selectors.

    *   Any manipulations using DOM-like API.

    *   Auto-detect input encoding.

    *   Fully integration in perl and memory management. You don't care
        about "free" or "destroy".

    *   Supports async parsing, with optional event-loop intergration.

    *   Perl utf8-enabled strings supports (See "WORK WITH UTF8" for
        details.)

HTML5::DOM
    HTML5 parser object.

  new
     use warnings;
     use strict;
     use HTML5::DOM;
 
     my $parser;
 
     # with default options
     $parser = HTML5::DOM-&gt;new;
 
     # or override some options, if you need
     $parser = HTML5::DOM-&gt;new({
        threads                 =&gt; 0,
        ignore_whitespace       =&gt; 0, 
        ignore_doctype          =&gt; 0, 
        scripts                 =&gt; 0, 
        encoding                =&gt; "auto", 
        default_encoding        =&gt; "UTF-8", 
        encoding_use_meta       =&gt; 1, 
        encoding_use_bom        =&gt; 1, 
        encoding_prescan_limit  =&gt; 1024
     });

    Creates new parser object with options. See "PARSER OPTIONS" for
    details.

   parse
     use warnings;
     use strict;
     use HTML5::DOM;
 
     my $parser = HTML5::DOM-&gt;new;
 
     my $html = '&lt;div&gt;Hello world!&lt;/div&gt;';
 
     my $tree;
 
     # parsing with options defined in HTML5::DOM-&gt;new
     $tree = $parser-&gt;parse($html);
 
     # parsing with custom options (extends options defined in HTML5::DOM-&gt;new)
     $tree = $parser-&gt;parse($html, {
         scripts     =&gt; 0, 
     });

    Parse html string and return HTML5::DOM::Tree object.

   parseChunkStart
     use warnings;
     use strict;
     use HTML5::DOM;
 
     my $parser = HTML5::DOM-&gt;new;
 
     # start chunked parsing with options defined in HTML5::DOM-&gt;new
     # call parseChunkStart without options is useless, 
     # because first call of parseChunk automatically call parseChunkStart. 
     $parser-&gt;parseChunkStart();
 
     # start chunked parsing with custom options (extends options defined in HTML5::DOM-&gt;new)
     $parser-&gt;parseChunkStart({
        scripts     =&gt; 0, 
     });

    Init chunked parsing. See "PARSER OPTIONS" for details.

   parseChunk
     use warnings;
     use strict;
     use HTML5::DOM;
 
     my $parser = HTML5::DOM-&gt;new;
 
     $parser-&gt;parseChunkStart()-&gt;parseChunk('&lt;')-&gt;parseChunk('di')-&gt;parseChunk('v&gt;');

    Parse chunk of html stream.

   parseChunkTree
     use warnings;
     use strict;
     use HTML5::DOM;
 
     my $parser = HTML5::DOM-&gt;new;
 
     # start some chunked parsing
     $parser-&gt;parseChunk('&lt;')-&gt;parseChunk('di')-&gt;parseChunk('v&gt;');
 
     # get current tree
     my $tree = $parser-&gt;parseChunkTree;
 
     print $tree-&gt;html."\n"; # &lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;div&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;
 
     # more parse html
     $parser-&gt;parseChunk('&lt;div class="red"&gt;red div?&lt;/div&gt;');
 
     print $tree-&gt;html."\n"; # &lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;div&gt;&lt;div class="red"&gt;red div?&lt;/div&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;
 
     # end parsing
     $parser-&gt;parseChunkEnd();
 
     print $tree-&gt;html."\n"; # &lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;div&gt;&lt;div class="red"&gt;red div?&lt;/div&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;

    Return current HTML5::DOM::Tree object (live result of all calls
    parseChunk).

   parseChunkEnd
     use warnings;
     use strict;
     use HTML5::DOM;
 
     my $parser = HTML5::DOM-&gt;new;
 
     # start some chunked parsing
     $parser-&gt;parseChunk('&lt;')-&gt;parseChunk('di')-&gt;parseChunk('v&gt;');
 
     # end parsing and get tree
     my $tree = $parser-&gt;parseChunkEnd();
 
     print $tree-&gt;html; # &lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;div&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;

    Completes chunked parsing and return HTML5::DOM::Tree object.

   parseAsync
    Parsing html in background thread. Can use with different ways:

    1. Manual wait parsing completion when you need.

     use warnings;
     use strict;
     use HTML5::DOM;
 
     my $parser = HTML5::DOM-&gt;new;
 
     my $html = '&lt;div&gt;Hello world!&lt;/div&gt;';
 
     my $async;
 
     # start async parsing
     $async = $parser-&gt;parseAsync($html);
 
     # or with options
     $async = $parser-&gt;parseAsync($html, { scripts =&gt; 0 });
 
     # ...do some work...
 
     # wait for parsing done
     my $tree = $async-&gt;wait;
 
     # work with tree
     print $tree-&gt;html;

    "$async-&gt;wait" returns HTML5::DOM::AsyncResult object.

    2. Non-blocking check for parsing completion.

     use warnings;
     use strict;
     use HTML5::DOM;
 
     my $parser = HTML5::DOM-&gt;new;
 
     my $html = '&lt;div&gt;Hello world!&lt;/div&gt;';
 
     my $tree;
     my $async;
 
     # start async parsing
     $async = $parser-&gt;parseAsync($html);
 
     # or with options
     $async = $parser-&gt;parseAsync($html, { scripts =&gt; 0 });
 
     while (!$async-&gt;parsed) {
         # do some work
     }
     $tree = $async-&gt;tree; # HTML5::DOM::Tree
     # work with $tree
     print $tree-&gt;root-&gt;at('div')-&gt;text."\n"; # Hello world!
 
     # or another way
 
     # start async parsing
     $async = $parser-&gt;parseAsync($html);
 
     # or with options
     $async = $parser-&gt;parseAsync($html, { scripts =&gt; 0 });
 
     while (!($tree = $async-&gt;tree)) {
         # do some work
     }
     # work with $tree
     print $tree-&gt;root-&gt;at('div')-&gt;text."\n"; # Hello world!

    "$async-&gt;parsed" returns 1 if parsing done. Else returns 0.

    "$async-&gt;tree" returns HTML5::DOM::Tree object if parsing done. Else
    returns "undef".

    3. Intergation with EV &lt;https://metacpan.org/pod/EV&gt;

    Required packages (only if you want use event loop):

    *   EV &lt;https://metacpan.org/pod/EV&gt;

    *   AnyEvent::Util &lt;https://metacpan.org/pod/AnyEvent::Util&gt;

     use warnings;
     use strict;
     use EV;
     use HTML5::DOM;
 
     my $parser = HTML5::DOM-&gt;new;
     my $html = '&lt;div&gt;Hello world!&lt;/div&gt;';
 
     my $custom_options = { scripts =&gt; 0 };
 
     $parser-&gt;parseAsync($html, $custom_options, sub {
         my $tree = shift;
         # work with $tree
         print $tree-&gt;root-&gt;at('div')-&gt;text."\n"; # Hello world!
     });
 
     # do some work
 
     EV::loop;

    Function returns HTML5::DOM::AsyncResult object.

    $tree in callback is a HTML5::DOM::Tree object.

    4. Intergation with custom event-loop (example with AnyEvent loop)

     use warnings;
     use strict;
     use AnyEvent;
     use AnyEvent::Util;
     use HTML5::DOM;
 
     my $parser = HTML5::DOM-&gt;new;
     my $html = '&lt;div&gt;Hello world!&lt;/div&gt;';
 
     my $custom_options = { scripts =&gt; 0 };
 
     # create pipe
     my ($r, $w) = AnyEvent::Util::portable_pipe();
     AnyEvent::fh_unblock $r;
 
     # fd for parseAsync communications
     my $write_fd = fileno($w);
 
     # after parsing complete module writes to $write_fd:
     # value "1" - if success
     # value "0" - if error
     my $async = $parser-&gt;parseAsync($html, $custom_options, $write_fd);
 
     # watch for value
     my $async_watcher;
     $async_watcher = AE::io $r, 0, sub {
         &lt;$r&gt;; # read "1" or "0"
         $async_watcher = undef; # destroy watcher
     
         # work with $tree
         my $tree = $async-&gt;wait;
         print $tree-&gt;root-&gt;at('div')-&gt;text."\n"; # Hello world!
     };
 
     # ...do some work...
 
     AE::cv-&gt;recv;

    $tree in callback is a HTML5::DOM::Tree object.

HTML5::DOM::Tree
    DOM tree object.

   createElement
     # create new node with tag "div"
     my $node = $tree-&gt;createElement("div");
 
     # create new node with tag "g" with namespace "svg"
     my $node = $tree-&gt;createElement("div", "svg");

    Create new HTML5::DOM::Element with specified tag and namespace.

   createComment
     # create new comment
     my $node = $tree-&gt;createComment(" ololo ");
 
     print $node-&gt;html; # &lt;!-- ololo --&gt;

    Create new HTML5::DOM::Comment with specified value.

   createTextNode
     # create new text node
     my $node = $tree-&gt;createTextNode("psh psh ololo i am driver of ufo &gt;&gt;&gt;");
 
     print $node-&gt;html; # psh psh ololo i am driver of ufo &amp;gt;&amp;gt;&amp;gt;

    Create new HTML5::DOM::Text with specified value.

   parseFragment
     my $fragment = $tree-&gt;parseFragment($html);
     my $fragment = $tree-&gt;parseFragment($html, $context);
     my $fragment = $tree-&gt;parseFragment($html, $context, $context_ns);
     my $fragment = $tree-&gt;parseFragment($html, $context, $context_ns, $options);

    Parse fragment html and create new HTML5::DOM::Fragment. For more
    details about fragments:
    &lt;https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragme
    nts&gt;

    *   $html - html fragment string

    *   $context - context tag name, default "div"

    *   $context_ns - context tag namespace, default "html"

    *   $options - parser options

        See "PARSER OPTIONS" for details.

     # simple create new fragment
     my $node = $tree-&gt;parseFragment("some &lt;b&gt;bold&lt;/b&gt; and &lt;i&gt;italic&lt;/i&gt; text");

     # create new fragment node with custom context tag/namespace and options
     my $node = $tree-&gt;parseFragment("some &lt;b&gt;bold&lt;/b&gt; and &lt;i&gt;italic&lt;/i&gt; text", "div", "html", {
        # some options override
        encoding =&gt; "windows-1251"
     });
 
     print $node-&gt;html; # some &lt;b&gt;bold&lt;/b&gt; and &lt;i&gt;italic&lt;/i&gt; text

   document
     my $node = $tree-&gt;document;

    Return HTML5::DOM::Document node of current tree;

   root
     my $node = $tree-&gt;root;

    Return root node of current tree. (always &lt;html&gt;)

   head
     my $node = $tree-&gt;head;

    Return &lt;head&gt; node of current tree.

   body
     my $node = $tree-&gt;body;

    Return &lt;body&gt; node of current tree.

   at
   querySelector
     my $node = $tree-&gt;at($selector);
     my $node = $tree-&gt;querySelector($selector); # alias

    Find one element node in tree using CSS Selectors Level 4
    &lt;https://www.w3.org/TR/selectors-4/&gt;

    Return node, or "undef" if not find.

    *   $selector - selector query as plain text or precompiled as
        HTML5::DOM::CSS::Selector or HTML5::DOM::CSS::Selector.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;div class="red"&gt;red&lt;/div&gt;&lt;div class="blue"&gt;blue&lt;/div&gt;')
     my $node = $tree-&gt;at('body &gt; div.red');
     print $node-&gt;html; # &lt;div class="red"&gt;red&lt;/div&gt;

   find
   querySelectorAll
     my $collection = $tree-&gt;find($selector);
     my $collection = $tree-&gt;querySelectorAll($selector); # alias

    Find all element nodes in tree using CSS Selectors Level 4
    &lt;https://www.w3.org/TR/selectors-4/&gt;

    Return HTML5::DOM::Collection.

    *   $selector - selector query as plain text or precompiled as
        HTML5::DOM::CSS::Selector or HTML5::DOM::CSS::Selector.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;div class="red"&gt;red&lt;/div&gt;&lt;div class="blue"&gt;blue&lt;/div&gt;')
     my $collection = $tree-&gt;at('body &gt; div.red, body &gt; div.blue');
     print $collection-&gt;[0]-&gt;html; # &lt;div class="red"&gt;red&lt;/div&gt;
     print $collection-&gt;[1]-&gt;html; # &lt;div class="red"&gt;blue&lt;/div&gt;

   findId
   getElementById
     my $collection = $tree-&gt;findId($tag);
     my $collection = $tree-&gt;getElementById($tag); # alias

    Find element node with specified id.

    Return HTML5::DOM::Node or "undef".

     my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;div class="red"&gt;red&lt;/div&gt;&lt;div class="blue" id="test"&gt;blue&lt;/div&gt;')
     my $node = $tree-&gt;findId('test');
     print $node-&gt;html; # &lt;div class="blue" id="test"&gt;blue&lt;/div&gt;

   findTag
   getElementsByTagName
     my $collection = $tree-&gt;findTag($tag);
     my $collection = $tree-&gt;getElementsByTagName($tag); # alias

    Find all element nodes in tree with specified tag name.

    Return HTML5::DOM::Collection.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;div class="red"&gt;red&lt;/div&gt;&lt;div class="blue"&gt;blue&lt;/div&gt;')
     my $collection = $tree-&gt;findTag('div');
     print $collection-&gt;[0]-&gt;html; # &lt;div class="red"&gt;red&lt;/div&gt;
     print $collection-&gt;[1]-&gt;html; # &lt;div class="red"&gt;blue&lt;/div&gt;

   findClass
   getElementsByClassName
     my $collection = $tree-&gt;findClass($class);
     my $collection = $tree-&gt;getElementsByClassName($class); # alias

    Find all element nodes in tree with specified class name. This is more
    fast equivalent to [class~="value"] selector.

    Return HTML5::DOM::Collection.

     my $tree = HTML5::DOM-&gt;new
        -&gt;parse('&lt;div class="red color"&gt;red&lt;/div&gt;&lt;div class="blue color"&gt;blue&lt;/div&gt;');
     my $collection = $tree-&gt;findClass('color');
     print $collection-&gt;[0]-&gt;html; # &lt;div class="red color"&gt;red&lt;/div&gt;
     print $collection-&gt;[1]-&gt;html; # &lt;div class="red color"&gt;blue&lt;/div&gt;

   findAttr
   getElementByAttribute
     # Find all elements with attribute
     my $collection = $tree-&gt;findAttr($attribute);
     my $collection = $tree-&gt;getElementByAttribute($attribute); # alias
 
     # Find all elements with attribute and mathcing value
     my $collection = $tree-&gt;findAttr($attribute, $value, $case = 0, $cmp = '=');
     my $collection = $tree-&gt;getElementByAttribute($attribute, $value, $case = 0, $cmp = '='); # alias

    Find all element nodes in tree with specified attribute and optional
    matching value.

    Return HTML5::DOM::Collection.

     my $tree = HTML5::DOM-&gt;new
        -&gt;parse('&lt;div class="red color"&gt;red&lt;/div&gt;&lt;div class="blue color"&gt;blue&lt;/div&gt;');
     my $collection = $tree-&gt;findAttr('class', 'CoLoR', 1, '~');
     print $collection-&gt;[0]-&gt;html; # &lt;div class="red color"&gt;red&lt;/div&gt;
     print $collection-&gt;[1]-&gt;html; # &lt;div class="red color"&gt;blue&lt;/div&gt;

    CSS selector analogs:

     # [$attribute=$value]
     my $collection = $tree-&gt;findAttr($attribute, $value, 0, '=');
 
     # [$attribute=$value i]
     my $collection = $tree-&gt;findAttr($attribute, $value, 1, '=');
 
     # [$attribute~=$value]
     my $collection = $tree-&gt;findAttr($attribute, $value, 0, '~');
 
     # [$attribute|=$value]
     my $collection = $tree-&gt;findAttr($attribute, $value, 0, '|');
 
     # [$attribute*=$value]
     my $collection = $tree-&gt;findAttr($attribute, $value, 0, '*');

     # [$attribute^=$value]
     my $collection = $tree-&gt;findAttr($attribute, $value, 0, '^');

     # [$attribute$=$value]
     my $collection = $tree-&gt;findAttr($attribute, $value, 0, '$');

   encoding
   encodingId
     print "encoding: ".$tree-&gt;encoding."\n"; # UTF-8
     print "encodingId: ".$tree-&gt;encodingId."\n"; # 0

    Return current tree encoding. See "ENCODINGS" for details.

   tag2id
     print "tag id: ".HTML5::DOM-&gt;TAG_A."\n"; # tag id: 4
     print "tag id: ".$tree-&gt;tag2id("a")."\n"; # tag id: 4

    Convert tag name to id. Return 0 (HTML5::DOM-&gt;TAG__UNDEF), if tag not
    exists in tree. See "TAGS" for tag constants list.

   id2tag
     print "tag name: ".$tree-&gt;id2tag(4)."\n"; # tag name: a
     print "tag name: ".$tree-&gt;id2tag(HTML5::DOM-&gt;TAG_A)."\n"; # tag name: a

    Convert tag id to name. Return "undef", if tag id not exists in tree.
    See "TAGS" for tag constants list.

   namespace2id
     print "ns id: ".HTML5::DOM-&gt;NS_HTML."\n"; # ns id: 1
     print "ns id: ".$tree-&gt;namespace2id("html")."\n"; # ns id: 1

    Convert namespace name to id. Return 0 (HTML5::DOM-&gt;NS_UNDEF), if
    namespace not exists in tree. See "NAMESPACES" for namespace constants
    list.

   id2namespace
     print "ns name: ".$tree-&gt;id2namespace(1)."\n"; # ns name: html
     print "ns name: ".$tree-&gt;id2namespace(HTML5::DOM-&gt;NS_HTML)."\n"; # ns name: html

    Convert namespace id to name. Return "undef", if namespace id not
    exists. See "NAMESPACES" for namespace constants list.

   parser
     my $parser = $tree-&gt;parser;

    Return parent HTML5::DOM.

   utf8
    As getter - get 1 if all methods returns all strings with utf8 flag.

    Example with utf8:

     use warnings;
     use strict;
     use HTML5::DOM;
     use utf8;
 
     my $tree = HTML5::DOM-&gt;new-&gt;parse("&lt;b&gt;Ñ‚ÐµÑÑ‚&lt;/b&gt;");
     my $is_utf8_enabled = $tree-&gt;utf8;
     print "is_utf8_enabled=".($tree ? "true" : "false")."\n"; # true

    Or example with bytes:

     use warnings;
     use strict;
     use HTML5::DOM;
 
     my $tree = HTML5::DOM-&gt;new-&gt;parse("&lt;b&gt;Ñ‚ÐµÑÑ‚&lt;/b&gt;");
     my $is_utf8_enabled = $tree-&gt;utf8;
     print "is_utf8_enabled=".($tree ? "true" : "false")."\n"; # false

    As setter - enable or disable utf8 flag on all returned strings.

     use warnings;
     use strict;
     use HTML5::DOM;
     use utf8;
 
     my $tree = HTML5::DOM-&gt;new-&gt;parse("&lt;b&gt;Ñ‚ÐµÑÑ‚&lt;/b&gt;");
 
     print "is_utf8_enabled=".($tree-&gt;utf8 ? "true" : "false")."\n"; # true
     print length($tree-&gt;at('b')-&gt;text)." chars\n"; # 4 chars
 
     $selector-&gt;utf8(0);
 
     print "is_utf8_enabled=".($tree-&gt;utf8 ? "true" : "false")."\n"; # false
     print length($tree-&gt;at('b')-&gt;text)." bytes\n"; # 8 bytes

HTML5::DOM::Node
    DOM node object.

   tag
   nodeName
     my $tag_name = $node-&gt;tag;
     my $tag_name = $node-&gt;nodeName; # uppercase
     my $tag_name = $node-&gt;tagName;  # uppercase

    Return node tag name (eg. div or span)

     $node-&gt;tag($tag);
     $node-&gt;nodeName($tag); # alias
     $node-&gt;tagName($tag);  # alias

    Set new node tag name. Allow only for HTML5::DOM::Element nodes.

     print $node-&gt;html; # &lt;div&gt;&lt;/div&gt;
     $node-&gt;tag('span');
     print $node-&gt;html; # &lt;span&gt;&lt;/span&gt;
     print $node-&gt;tag; # span
     print $node-&gt;tag; # SPAN

   tagId
     my $tag_id = $node-&gt;tagId;

    Return node tag id. See "TAGS" for tag constants list.

     $node-&gt;tagId($tag_id);

    Set new node tag id. Allow only for HTML5::DOM::Element nodes.

     print $node-&gt;html; # &lt;div&gt;&lt;/div&gt;
     $node-&gt;tagId(HTML5::DOM-&gt;TAG_SPAN);
     print $node-&gt;html; # &lt;span&gt;&lt;/span&gt;
     print $node-&gt;tagId; # 117

   namespace
     my $tag_ns = $node-&gt;namespace;

    Return node namespace (eg. html or svg)

     $node-&gt;namespace($namespace);

    Set new node namespace name. Allow only for HTML5::DOM::Element nodes.

     print $node-&gt;namespace; # html
     $node-&gt;namespace('svg');
     print $node-&gt;namespace; # svg

   namespaceId
     my $tag_ns_id = $node-&gt;namespaceId;

    Return node namespace id. See "NAMESPACES" for tag constants list.

     $node-&gt;namespaceId($tag_id);

    Set new node namespace by id. Allow only for HTML5::DOM::Element nodes.

     print $node-&gt;namespace; # html
     $node-&gt;namespaceId(HTML5::DOM-&gt;NS_SVG);
     print $node-&gt;namespaceId; # 3
     print $node-&gt;namespace; # svg

   tree
     my $tree = $node-&gt;tree;

    Return parent HTML5::DOM::Tree.

   nodeType
     my $type = $node-&gt;nodeType;

    Return node type. All types:

     HTML5::DOM-&gt;ELEMENT_NODE                   =&gt; 1, 
     HTML5::DOM-&gt;ATTRIBUTE_NODE                 =&gt; 2,   # not supported
     HTML5::DOM-&gt;TEXT_NODE                      =&gt; 3, 
     HTML5::DOM-&gt;CDATA_SECTION_NODE             =&gt; 4,   # not supported
     HTML5::DOM-&gt;ENTITY_REFERENCE_NODE          =&gt; 5,   # not supported
     HTML5::DOM-&gt;ENTITY_NODE                    =&gt; 6,   # not supported
     HTML5::DOM-&gt;PROCESSING_INSTRUCTION_NODE    =&gt; 7,   # not supported
     HTML5::DOM-&gt;COMMENT_NODE                   =&gt; 8, 
     HTML5::DOM-&gt;DOCUMENT_NODE                  =&gt; 9, 
     HTML5::DOM-&gt;DOCUMENT_TYPE_NODE             =&gt; 10, 
     HTML5::DOM-&gt;DOCUMENT_FRAGMENT_NODE         =&gt; 11, 
     HTML5::DOM-&gt;NOTATION_NODE                  =&gt; 12   # not supported

    Compatible with:
    &lt;https://developer.mozilla.org/ru/docs/Web/API/Node/nodeType&gt;

   next
   nextElementSibling
     my $node2 = $node-&gt;next;
     my $node2 = $node-&gt;nextElementSibling; # alias

    Return next sibling element node

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;OSX&lt;/li&gt;
            &lt;li&gt;Windows&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $li = $tree-&gt;at('ul li');
     print $li-&gt;text;               # Linux
     print $li-&gt;next-&gt;text;         # OSX
     print $li-&gt;next-&gt;next-&gt;text;   # Windows

   prev
   previousElementSibling
     my $node2 = $node-&gt;prev;
     my $node2 = $node-&gt;previousElementSibling; # alias

    Return previous sibling element node

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;OSX&lt;/li&gt;
            &lt;li class="win"&gt;Windows&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $li = $tree-&gt;at('ul li.win');
     print $li-&gt;text;               # Windows
     print $li-&gt;prev-&gt;text;         # OSX
     print $li-&gt;prev-&gt;prev-&gt;text;   # Linux

   nextNode
   nextSibling
     my $node2 = $node-&gt;nextNode;
     my $node2 = $node-&gt;nextSibling; # alias

    Return next sibling node

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;OSX&lt;/li&gt;
            &lt;li&gt;Windows&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $li = $tree-&gt;at('ul li');
     print $li-&gt;text;                       # Linux
     print $li-&gt;nextNode-&gt;text;             # &lt;!-- comment --&gt;
     print $li-&gt;nextNode-&gt;nextNode-&gt;text;   # OSX

   prevNode
   previousSibling
     my $node2 = $node-&gt;prevNode;
     my $node2 = $node-&gt;previousSibling; # alias

    Return previous sibling node

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;OSX&lt;/li&gt;
            &lt;li class="win"&gt;Windows&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $li = $tree-&gt;at('ul li.win');
     print $li-&gt;text;                       # Windows
     print $li-&gt;prevNode-&gt;text;             # OSX
     print $li-&gt;prevNode-&gt;prevNode-&gt;text;   # &lt;!-- comment --&gt;

   first
   firstElementChild
     my $node2 = $node-&gt;first;
     my $node2 = $node-&gt;firstElementChild; # alias

    Return first children element

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;li&gt;OSX&lt;/li&gt;
            &lt;li class="win"&gt;Windows&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $ul = $tree-&gt;at('ul');
     print $ul-&gt;first-&gt;text; # Linux

   last
   lastElementChild
     my $node2 = $node-&gt;last;
     my $node2 = $node-&gt;lastElementChild; # alias

    Return last children element

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;li&gt;OSX&lt;/li&gt;
            &lt;li class="win"&gt;Windows&lt;/li&gt;
            &lt;!-- comment --&gt;
        &lt;/ul&gt;
     ');
     my $ul = $tree-&gt;at('ul');
     print $ul-&gt;last-&gt;text; # Windows

   firstNode
   firstChild
     my $node2 = $node-&gt;firstNode;
     my $node2 = $node-&gt;firstChild; # alias

    Return first children node

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;li&gt;OSX&lt;/li&gt;
            &lt;li class="win"&gt;Windows&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $ul = $tree-&gt;at('ul');
     print $ul-&gt;firstNode-&gt;html; # &lt;!-- comment --&gt;

   lastNode
   lastChild
     my $node2 = $node-&gt;lastNode;
     my $node2 = $node-&gt;lastChild; # alias

    Return last children node

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;li&gt;OSX&lt;/li&gt;
            &lt;li class="win"&gt;Windows&lt;/li&gt;
            &lt;!-- comment --&gt;
        &lt;/ul&gt;
     ');
     my $ul = $tree-&gt;at('ul');
     print $ul-&gt;lastNode-&gt;html; # &lt;!-- comment --&gt;

   html
    Universal html serialization and fragment parsing acessor, for single
    human-friendly api.

     my $html = $node-&gt;html();
     my $node = $node-&gt;html($new_html);

    *   As getter this similar to outerText

    *   As setter this similar to innerText

    *   As setter for non-element nodes this similar to nodeValue

     my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;div id="test"&gt;some   text &lt;b&gt;bold&lt;/b&gt;&lt;/div&gt;');
 
     # get text content for element
     my $node = $tree-&gt;at('#test');
     print $node-&gt;html;                     # &lt;div id="test"&gt;some   text &lt;b&gt;bold&lt;/b&gt;&lt;/div&gt;
     $comment-&gt;html('&lt;b&gt;new&lt;/b&gt;');
     print $comment-&gt;html;                  # &lt;div id="test"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/div&gt;
 
     my $comment = $tree-&gt;createComment(" comment text ");
     print $comment-&gt;html;                  # &lt;!-- comment text --&gt;
     $comment-&gt;html(' new comment text ');
     print $comment-&gt;html;                  # &lt;!-- new comment text --&gt;
 
     my $text_node = $tree-&gt;createTextNode("plain text &gt;");
     print $text_node-&gt;html;                # plain text &amp;gt;
     $text_node-&gt;html('new&gt;plain&gt;text');
     print $text_node-&gt;html;                # new&amp;gt;plain&amp;gt;text

   innerHTML
   outerHTML
    *   HTML serialization of the node's descendants.

         my $html = $node-&gt;html;
         my $html = $node-&gt;outerHTML;

        Example:

         my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;div id="test"&gt;some &lt;b&gt;bold&lt;/b&gt; test&lt;/div&gt;');
         print $tree-&gt;getElementById('test')-&gt;outerHTML;   # &lt;div id="test"&gt;some &lt;b&gt;bold&lt;/b&gt; test&lt;/div&gt;
         print $tree-&gt;createComment(' test ')-&gt;outerHTML;  # &lt;!-- test --&gt;
         print $tree-&gt;createTextNode('test')-&gt;outerHTML;   # test

    *   HTML serialization of the node and its descendants.

         # serialize descendants, without node
         my $html = $node-&gt;innerHTML;

        Example:

         my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;div id="test"&gt;some &lt;b&gt;bold&lt;/b&gt; test&lt;/div&gt;');
         print $tree-&gt;getElementById('test')-&gt;innerHTML;   # some &lt;b&gt;bold&lt;/b&gt; test
         print $tree-&gt;createComment(' test ')-&gt;innerHTML;  # &lt;!-- test --&gt;
         print $tree-&gt;createTextNode('test')-&gt;innerHTML;   # test

    *   Removes all of the element's descendants and replaces them with
        nodes constructed by parsing the HTML given in the string $new_html.

         # parse fragment and replace child nodes with it
         my $html = $node-&gt;html($new_html);
         my $html = $node-&gt;innerHTML($new_html);

        Example:

         my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;div id="test"&gt;some &lt;b&gt;bold&lt;/b&gt; test&lt;/div&gt;');
         print $tree-&gt;at('#test')-&gt;innerHTML('&lt;i&gt;italic&lt;/i&gt;');
         print $tree-&gt;body-&gt;innerHTML;  # &lt;div id="test"&gt;&lt;i&gt;italic&lt;/i&gt;&lt;/div&gt;

    *   HTML serialization of entire document

          my $html = $tree-&gt;document-&gt;html;
          my $html = $tree-&gt;document-&gt;outerHTML;

        Example:

          my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;!DOCTYPE html&gt;&lt;div id="test"&gt;some &lt;b&gt;bold&lt;/b&gt; test&lt;/div&gt;');
          print $tree-&gt;document-&gt;outerHTML;   # &lt;!DOCTYPE html&gt;&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;div id="test"&gt;some &lt;b&gt;bold&lt;/b&gt; test&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;

    *   Replaces the element and all of its descendants with a new DOM tree
        constructed by parsing the specified $new_html.

         # parse fragment and node in parent node childs with it
         my $html = $node-&gt;outerHTML($new_html);

        Example:

         my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;div id="test"&gt;some &lt;b&gt;bold&lt;/b&gt; test&lt;/div&gt;');
         print $tree-&gt;at('#test')-&gt;outerHTML('&lt;i&gt;italic&lt;/i&gt;');
         print $tree-&gt;body-&gt;innerHTML;  # &lt;i&gt;italic&lt;/i&gt;

    See, for more info:

    &lt;https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML&gt;

    &lt;https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML&gt;

   text
    Universal text acessor, for single human-friendly api.

     my $text = $node-&gt;text();
     my $node = $node-&gt;text($new_text);

    *   For HTML5::DOM::Text is similar to nodeValue (as setter/getter)

    *   For HTML5::DOM::Comment is similar to nodeValue (as setter/getter)

    *   For HTML5::DOM::DocType is similar to nodeValue (as setter/getter)

    *   For HTML5::DOM::Element is similar to textContent (as setter/getter)

     my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;div id="test"&gt;some   text &lt;b&gt;bold&lt;/b&gt;&lt;/div&gt;');
 
     # get text content for element
     my $node = $tree-&gt;at('#test');
     print $node-&gt;text;                     # some   text bold
     $comment-&gt;text('&lt;new node content&gt;');
     print $comment-&gt;html;                  # &amp;lt;new node conten&amp;gt;
 
     my $comment = $tree-&gt;createComment("comment text");
     print $comment-&gt;text;                  # comment text
     $comment-&gt;text(' new comment text ');
     print $comment-&gt;html;                  # &lt;!-- new comment text --&gt;
 
     my $text_node = $tree-&gt;createTextNode("plain text");
     print $text_node-&gt;text;                # plain text
     $text_node-&gt;text('new&gt;plain&gt;text');
     print $text_node-&gt;html;                # new&amp;gt;plain&amp;gt;text

   innerText
   outerText
   textContent
    *   Represents the "rendered" text content of a node and its
        descendants. Using default CSS "display" property for tags based on
        Firefox user-agent style.

        Only works for elements, for other nodes return "undef".

         my $text = $node-&gt;innerText;
         my $text = $node-&gt;outerText; # alias

        Example:

         my $tree = HTML5::DOM-&gt;new-&gt;parse('
            &lt;div id="test"&gt;
                some       
                &lt;b&gt;      bold     &lt;/b&gt;       
                test
                &lt;script&gt;alert()&lt;/script&gt;
            &lt;/div&gt;
         ');
         print $tree-&gt;body-&gt;innerText; # some bold test

        See, for more info:
        &lt;https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-a
        ttribute&gt;

    *   Removes all of its children and replaces them with a text nodes and
        &lt;br&gt; with the given value. Only works for elements, for other nodes
        throws exception.

        *   All new line chars (\r\n, \r, \n) replaces to &lt;br /&gt;

        *   All other text content replaces to text nodes

         my $node = $node-&gt;innerText($text);

        Example:

         my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;div id="test"&gt;some text &lt;b&gt;bold&lt;/b&gt;&lt;/div&gt;');
         $tree-&gt;at('#test')-&gt;innerText("some\nnew\ntext &gt;");
         print $tree-&gt;at('#test')-&gt;html;    # &lt;div id="test"&gt;some&lt;br /&gt;new&lt;br /&gt;text &amp;gt;&lt;/div&gt;

        See, for more info:
        &lt;https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-a
        ttribute&gt;

    *   Removes the current node and replaces it with the given text. Only
        works for elements, for other nodes throws exception.

        *   All new line chars (\r\n, \r, \n) replaces to &lt;br /&gt;

        *   All other text content replaces to text nodes

        *   Similar to innerText($text), but removes current node

         my $node = $node-&gt;outerText($text);

        Example:

         my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;div id="test"&gt;some text &lt;b&gt;bold&lt;/b&gt;&lt;/div&gt;');
         $tree-&gt;at('#test')-&gt;outerText("some\nnew\ntext &gt;");
         print $tree-&gt;body-&gt;html;   # &lt;body&gt;some&lt;br /&gt;new&lt;br /&gt;text &amp;gt;&lt;/body&gt;

        See, for more info:
        &lt;https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/outerT
        ext&gt;

    *   Represents the text content of a node and its descendants.

        Only works for elements, for other nodes return "undef".

         my $text = $node-&gt;text;
         my $text = $node-&gt;textContent; # alias

        Example:

         my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;b&gt;    test      &lt;/b&gt;&lt;script&gt;alert()&lt;/script&gt;');
         print $tree-&gt;body-&gt;text; #     test      alert()

        See, for more info:
        &lt;https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent&gt;

    *   Removes all of its children and replaces them with a single text
        node with the given value.

         my $node = $node-&gt;text($new_text);
         my $node = $node-&gt;textContent($new_text);

        Example:

         my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;div id="test"&gt;some &lt;b&gt;bold&lt;/b&gt; test&lt;/div&gt;');
         print $tree-&gt;at('#test')-&gt;text('&lt;bla bla bla&gt;');
         print $tree-&gt;at('#test')-&gt;html;  # &lt;div id="test"&gt;&amp;lt;bla bla bla&amp;gt;&lt;/div&gt;

        See, for more info:
        &lt;https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent&gt;

   nodeHtml
     my $html = $node-&gt;nodeHtml();

    Serialize to html, without descendants and closing tag.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;div id="test"&gt;some &lt;b&gt;bold&lt;/b&gt; test&lt;/div&gt;');
     print $tree-&gt;at('#test')-&gt;nodeHtml(); # &lt;div id="test"&gt;

   nodeValue
   data
     my $value = $node-&gt;nodeValue();
     my $value = $node-&gt;data(); # alias

     my $node = $node-&gt;nodeValue($new_value);
     my $node = $node-&gt;data($new_value); # alias

    Get or set value of node. Only works for non-element nodes, such as
    HTML5::DOM::Element, HTML5::DOM::Element, HTML5::DOM::Element. Return
    "undef" for other.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('');
     my $comment = $tree-&gt;createComment("comment text");
     print $comment-&gt;nodeValue;                 # comment text
     $comment-&gt;nodeValue(' new comment text ');
     print $comment-&gt;html;                      # &lt;!-- new comment text --&gt;

   isConnected
     my $flag = $node-&gt;isConnected;

    Return true, if node has parent.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;div id="test"&gt;&lt;/div&gt;
     ');
     print $tree-&gt;at('#test')-&gt;isConnected;             # 1
     print $tree-&gt;createElement("div")-&gt;isConnected;    # 0

   parent
   parentElement
     my $node = $node-&gt;parent;
     my $node = $node-&gt;parentElement; # alias

    Return parent node. Return "undef", if node detached.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;div id="test"&gt;&lt;/div&gt;
     ');
     print $tree-&gt;at('#test')-&gt;parent-&gt;tag; # body

   document
   ownerDocument
     my $doc = $node-&gt;document;
     my $doc = $node-&gt;ownerDocument; # alias

    Return parent HTML5::DOM::Document.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;div id="test"&gt;&lt;/div&gt;
     ');
     print ref($tree-&gt;at('#test')-&gt;document);   # HTML5::DOM::Document

   append
   appendChild
     my $node = $node-&gt;append($child);
     my $child = $node-&gt;appendChild($child); # alias

    Append node to child nodes.

    append - returned value is the self node, for chain calls

    appendChild - returned value is the appended child except when the given
    child is a HTML5::DOM::Fragment, in which case the empty
    HTML5::DOM::Fragment is returned.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;div&gt;some &lt;b&gt;bold&lt;/b&gt; text&lt;/div&gt;
     ');
     $tree-&gt;at('div')
        -&gt;append($tree-&gt;createElement('br'))
        -&gt;append($tree-&gt;createElement('br'));
     print $tree-&gt;at('div')-&gt;html; # &lt;div&gt;some &lt;b&gt;bold&lt;/b&gt; text&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;

   prepend
   prependChild
     my $node = $node-&gt;prepend($child);
     my $child = $node-&gt;prependChild($child); # alias

    Prepend node to child nodes.

    prepend - returned value is the self node, for chain calls

    prependChild - returned value is the prepended child except when the
    given child is a HTML5::DOM::Fragment, in which case the empty
    HTML5::DOM::Fragment is returned.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;div&gt;some &lt;b&gt;bold&lt;/b&gt; text&lt;/div&gt;
     ');
     $tree-&gt;at('div')
        -&gt;prepend($tree-&gt;createElement('br'))
        -&gt;prepend($tree-&gt;createElement('br'));
     print $tree-&gt;at('div')-&gt;html; # &lt;div&gt;&lt;br /&gt;&lt;br /&gt;some &lt;b&gt;bold&lt;/b&gt; text&lt;/div&gt;

   replace
   replaceChild
     my $old_node = $old_node-&gt;replace($new_node);
     my $old_node = $old_node-&gt;parent-&gt;replaceChild($new_node, $old_node); # alias

    Replace node in parent child nodes.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;div&gt;some &lt;b&gt;bold&lt;/b&gt; text&lt;/div&gt;
     ');
     my $old = $tree-&gt;at('b')-&gt;replace($tree-&gt;createElement('br'));
     print $old-&gt;html;              # &lt;b&gt;bold&lt;/b&gt;
     print $tree-&gt;at('div')-&gt;html;  # &lt;div&gt;some &lt;br /&gt; text&lt;/div&gt;

   before
   insertBefore
     my $node = $node-&gt;before($new_node);
     my $new_node = $node-&gt;parent-&gt;insertBefore($new_node, $node); # alias

    Insert new node before current node.

    before - returned value is the self node, for chain calls

    insertBefore - returned value is the added child except when the given
    child is a HTML5::DOM::Fragment, in which case the empty
    HTML5::DOM::Fragment is returned.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;div&gt;some &lt;b&gt;bold&lt;/b&gt; text&lt;/div&gt;
     ');
     $tree-&gt;at('b')-&gt;before($tree-&gt;createElement('br'));
     print $tree-&gt;at('div')-&gt;html; # &lt;div&gt;some &lt;br /&gt;&lt;b&gt;bold&lt;/b&gt; text&lt;/div&gt;

   after
   insertAfter
     my $node = $node-&gt;after($new_node);
     my $new_node = $node-&gt;parent-&gt;insertAfter($new_node, $node); # alias

    Insert new node after current node.

    after - returned value is the self node, for chain calls

    insertAfter - returned value is the added child except when the given
    child is a HTML5::DOM::Fragment, in which case the empty
    HTML5::DOM::Fragment is returned.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;div&gt;some &lt;b&gt;bold&lt;/b&gt; text&lt;/div&gt;
     ');
     $tree-&gt;at('b')-&gt;after($tree-&gt;createElement('br'));
     print $tree-&gt;at('div')-&gt;html; # &lt;div&gt;some &lt;b&gt;bold&lt;/b&gt;&lt;br /&gt; text&lt;/div&gt;

   remove
   removeChild
     my $node = $node-&gt;remove;
     my $node = $node-&gt;parent-&gt;removeChild($node); # alias

    Remove node from parent. Return removed node.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;div&gt;some &lt;b&gt;bold&lt;/b&gt; text&lt;/div&gt;
     ');
     print $tree-&gt;at('b')-&gt;remove-&gt;html;    # &lt;b&gt;bold&lt;/b&gt;
     print $tree-&gt;at('div')-&gt;html;          # &lt;div&gt;some  text&lt;/div&gt;

   clone
   cloneNode
     # clone node to current tree
     my $node = $node-&gt;clone($deep = 0);
     my $node = $node-&gt;cloneNode($deep = 0); # alias

     # clone node to foreign tree
     my $node = $node-&gt;clone($deep, $new_tree);
     my $node = $node-&gt;cloneNode($deep, $new_tree); # alias

    Clone node.

    deep = 0 - only specified node, without childs.

    deep = 1 - deep copy with all child nodes.

    new_tree - destination tree (if need copy to foreign tree)

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;div&gt;some &lt;b&gt;bold&lt;/b&gt; text&lt;/div&gt;
     ');
     print $tree-&gt;at('b')-&gt;clone(0)-&gt;html; # &lt;b&gt;&lt;/b&gt;
     print $tree-&gt;at('b')-&gt;clone(1)-&gt;html; # &lt;b&gt;bold&lt;/b&gt;

   void
     my $flag = $node-&gt;void;

    Return true if node is void. For more details:
    &lt;http://w3c.github.io/html-reference/syntax.html#void-elements&gt;

     print $tree-&gt;createElement('br')-&gt;void; # 1

   selfClosed
     my $flag = $node-&gt;selfClosed;

    Return true if node self closed.

     print $tree-&gt;createElement('br')-&gt;selfClosed; # 1

   position
     my $position = $node-&gt;position;

    Return offsets in input buffer.

     print Dumper($node-&gt;position);
     # $VAR1 = {'raw_length' =&gt; 3, 'raw_begin' =&gt; 144, 'element_begin' =&gt; 143, 'element_length' =&gt; 5}

   isSameNode
     my $flag = $node-&gt;isSameNode($other_node);

    Tests whether two nodes are the same, that is if they reference the same
    object.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;test&lt;/li&gt;
            &lt;li&gt;not test&lt;/li&gt;
            &lt;li&gt;test&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $li = $tree-&gt;find('li');
     print $li-&gt;[0]-&gt;isSameNode($li-&gt;[0]); # 1
     print $li-&gt;[0]-&gt;isSameNode($li-&gt;[1]); # 0
     print $li-&gt;[0]-&gt;isSameNode($li-&gt;[2]); # 0

HTML5::DOM::Element
    DOM node object for elements. Inherit all methods from HTML5::DOM::Node.

   children
     my $collection = $node-&gt;children;

    Returns all child elements of current node in HTML5::DOM::Collection.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Perl&lt;/li&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;PHP&lt;/li&gt;
            &lt;li&gt;C++&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $collection = $tree-&gt;at('ul')-&gt;children;
     print $collection-&gt;[0]-&gt;html; # &lt;li&gt;Perl&lt;/li&gt;
     print $collection-&gt;[1]-&gt;html; # &lt;li&gt;PHP&lt;/li&gt;
     print $collection-&gt;[2]-&gt;html; # &lt;li&gt;C++&lt;/li&gt;

   childrenNode
   childNodes
     my $collection = $node-&gt;childrenNode;
     my $collection = $node-&gt;childNodes; # alias

    Returns all child nodes of current node in HTML5::DOM::Collection.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Perl&lt;/li&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;PHP&lt;/li&gt;
            &lt;li&gt;C++&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $collection = $tree-&gt;at('ul')-&gt;childrenNode;
     print $collection-&gt;[0]-&gt;html; # &lt;li&gt;Perl&lt;/li&gt;
     print $collection-&gt;[1]-&gt;html; # &lt;!-- comment --&gt;
     print $collection-&gt;[2]-&gt;html; # &lt;li&gt;PHP&lt;/li&gt;
     print $collection-&gt;[3]-&gt;html; # &lt;li&gt;C++&lt;/li&gt;

   attr
   removeAttr
    Universal attributes accessor, for single human-friendly api.

     # attribute get
     my $value = $node-&gt;attr($key);
 
     # attribute set
     my $node = $node-&gt;attr($key, $value);
     my $node = $node-&gt;attr($key =&gt; $value);
 
     # attribute remove
     my $node = $node-&gt;attr($key, undef);
     my $node = $node-&gt;attr($key =&gt; undef);
     my $node = $node-&gt;removeAttr($key);
 
     # bulk attributes set
     my $node = $node-&gt;attr({$key =&gt; $value, $key2 =&gt; $value2});
 
     # bulk attributes remove
     my $node = $node-&gt;attr({$key =&gt; undef, $key2 =&gt; undef});
 
     # bulk get all attributes in hash
     my $hash = $node-&gt;attr;

    Example:

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;div id="test" data-test="test value" data-href="#"&gt;&lt;/div&gt;
     ');
     my $div = $tree-&gt;at('#test');
     $div-&gt;attr("data-new", "test");
     print $div-&gt;attr("data-test");     # test value
     print $div-&gt;{"data-test"};         # test value
     print $div-&gt;attr-&gt;{"data-test"};   # test value
 
     # {id =&gt; "test", "data-test" =&gt; "test value", "data-href" =&gt; "#", "data-new" =&gt; "test"}
     print Dumper($div-&gt;attr);
 
     $div-&gt;removeAttr("data-test");
 
     # {id =&gt; "test", "data-href" =&gt; "#", "data-new" =&gt; "test"}
     print Dumper($div-&gt;attr);

   attrArray
     my $arr = $node-&gt;attrArray;

    Get all attributes in array (in tree order).

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;div id="test" data-test="test value" data-href="#"&gt;&lt;/div&gt;
     ');
     my $div = $tree-&gt;at('#test');
 
     # [{key =&gt; 'id', value =&gt; 'test'}, {key =&gt; 'data-test', value =&gt; 'test'}, {key =&gt; 'data-href', value =&gt; '#'}]
     print Dumper($div-&gt;attrArray);

   getAttribute
     my $value = $node-&gt;getAttribute($key);
     my $value = $node-&gt;attr($key); # alias

    Get attribute value by key.

   setAttribute
     my $node = $node-&gt;setAttribute($key, $value);
     my $node = $node-&gt;attr($key, $value); # alias

    Set new value or create new attibute.

   removeAttribute
     my $node = $node-&gt;removeAttribute($key);
     my $node = $node-&gt;removeAttr($key); # alias

    Remove attribute.

   className
     my $classes = $node-&gt;className;
     # alias for
     my $classes = $node-&gt;attr("class");

   classList
     my $class_list = $node-&gt;classList;
 
     # has class
     my $flag = $class_list-&gt;has($class_name);
     my $flag = $class_list-&gt;contains($class_name);
 
     # add class
     my $class_list = $class_list-&gt;add($class_name);
     my $class_list = $class_list-&gt;add($class_name, $class_name1, $class_name2, ...);

     # add class
     my $class_list = $class_list-&gt;remove($class_name);
     my $class_list = $class_list-&gt;remove($class_name, $class_name1, $class_name2, ...);

     # toggle class
     my $state = $class_list-&gt;toggle($class_name);
     my $state = $class_list-&gt;toggle($class_name, $force_state);

    Manipulations with classes. Returns HTML5::DOM::TokenList.

    Similar to
    &lt;https://developer.mozilla.org/en-US/docs/Web/API/Element/classList&gt;

     my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;div class="red"&gt;red&lt;/div&gt;')
     my $node = $tree-&gt;body-&gt;at('.red');
     print $node-&gt;has('red');                       # 1
     print $node-&gt;has('blue');                      # 0
     $node-&gt;add('blue', 'red', 'yellow', 'orange');
     print $node-&gt;className;                        # red blue yellow orange
     $node-&gt;remove('blue', 'orange');
     print $node-&gt;className;                        # red yellow
     print $node-&gt;toggle('blue');                   # 1
     print $node-&gt;className;                        # red yellow blue
     print $node-&gt;toggle('blue');                   # 0
     print $node-&gt;className;                        # red yellow

   at
   querySelector
     my $node = $node-&gt;at($selector);
     my $node = $node-&gt;at($selector, $combinator);
     my $node = $node-&gt;querySelector($selector); # alias
     my $node = $node-&gt;querySelector($selector, $combinator); # alias

    Find one element node in current node descendants using CSS Selectors
    Level 4 &lt;https://www.w3.org/TR/selectors-4/&gt;

    Return node, or "undef" if not find.

    *   $selector - selector query as plain text or precompiled as
        HTML5::DOM::CSS::Selector or HTML5::DOM::CSS::Selector.

    *   $combinator - custom selector combinator, applies to current node

        *   "&gt;&gt;" - descendant selector (default)

        *   "&gt;" - child selector

        *   "+" - adjacent sibling selector

        *   "~" - general sibling selector

        *   "||" - column combinator

     my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;div class="red"&gt;red&lt;/div&gt;&lt;div class="blue"&gt;blue&lt;/div&gt;')
     my $node = $tree-&gt;body-&gt;at('body &gt; div.red');
     print $node-&gt;html; # &lt;div class="red"&gt;red&lt;/div&gt;

   find
   querySelectorAll
     my $collection = $node-&gt;find($selector);
     my $collection = $node-&gt;find($selector, $combinator);
     my $collection = $node-&gt;querySelectorAll($selector); # alias
     my $collection = $node-&gt;querySelectorAll($selector, $combinator); # alias

    Find all element nodes in current node descendants using CSS Selectors
    Level 4 &lt;https://www.w3.org/TR/selectors-4/&gt;

    Return HTML5::DOM::Collection.

    *   $selector - selector query as plain text or precompiled as
        HTML5::DOM::CSS::Selector or HTML5::DOM::CSS::Selector.

    *   $combinator - custom selector combinator, applies to current node

        *   "&gt;&gt;" - descendant selector (default)

        *   "&gt;" - child selector

        *   "+" - adjacent sibling selector

        *   "~" - general sibling selector

        *   "||" - column combinator

     my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;div class="red"&gt;red&lt;/div&gt;&lt;div class="blue"&gt;blue&lt;/div&gt;')
     my $collection = $tree-&gt;body-&gt;at('body &gt; div.red, body &gt; div.blue');
     print $collection-&gt;[0]-&gt;html; # &lt;div class="red"&gt;red&lt;/div&gt;
     print $collection-&gt;[1]-&gt;html; # &lt;div class="red"&gt;blue&lt;/div&gt;

   findId
   getElementById
     my $node = $node-&gt;findId($tag);
     my $node = $node-&gt;getElementById($tag); # alias

    Find element node with specified id in current node descendants.

    Return HTML5::DOM::Node or "undef".

     my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;div class="red"&gt;red&lt;/div&gt;&lt;div class="blue" id="test"&gt;blue&lt;/div&gt;')
     my $node = $tree-&gt;body-&gt;findId('test');
     print $node-&gt;html; # &lt;div class="blue" id="test"&gt;blue&lt;/div&gt;

   findTag
   getElementsByTagName
     my $node = $node-&gt;findTag($tag);
     my $node = $node-&gt;getElementsByTagName($tag); # alias

    Find all element nodes in current node descendants with specified tag
    name.

    Return HTML5::DOM::Collection.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('&lt;div class="red"&gt;red&lt;/div&gt;&lt;div class="blue"&gt;blue&lt;/div&gt;')
     my $collection = $tree-&gt;body-&gt;findTag('div');
     print $collection-&gt;[0]-&gt;html; # &lt;div class="red"&gt;red&lt;/div&gt;
     print $collection-&gt;[1]-&gt;html; # &lt;div class="red"&gt;blue&lt;/div&gt;

   findClass
   getElementsByClassName
     my $collection = $node-&gt;findClass($class);
     my $collection = $node-&gt;getElementsByClassName($class); # alias

    Find all element nodes in current node descendants with specified class
    name. This is more fast equivalent to [class~="value"] selector.

    Return HTML5::DOM::Collection.

     my $tree = HTML5::DOM-&gt;new
        -&gt;parse('&lt;div class="red color"&gt;red&lt;/div&gt;&lt;div class="blue color"&gt;blue&lt;/div&gt;');
     my $collection = $tree-&gt;body-&gt;findClass('color');
     print $collection-&gt;[0]-&gt;html; # &lt;div class="red color"&gt;red&lt;/div&gt;
     print $collection-&gt;[1]-&gt;html; # &lt;div class="red color"&gt;blue&lt;/div&gt;

   findAttr
   getElementByAttribute
     # Find all elements with attribute
     my $collection = $node-&gt;findAttr($attribute);
     my $collection = $node-&gt;getElementByAttribute($attribute); # alias
 
     # Find all elements with attribute and mathcing value
     my $collection = $node-&gt;findAttr($attribute, $value, $case = 0, $cmp = '=');
     my $collection = $node-&gt;getElementByAttribute($attribute, $value, $case = 0, $cmp = '='); # alias

    Find all element nodes in tree with specified attribute and optional
    matching value.

    Return HTML5::DOM::Collection.

     my $tree = HTML5::DOM-&gt;new
        -&gt;parse('&lt;div class="red color"&gt;red&lt;/div&gt;&lt;div class="blue color"&gt;blue&lt;/div&gt;');
     my $collection = $tree-&gt;body-&gt;findAttr('class', 'CoLoR', 1, '~');
     print $collection-&gt;[0]-&gt;html; # &lt;div class="red color"&gt;red&lt;/div&gt;
     print $collection-&gt;[1]-&gt;html; # &lt;div class="red color"&gt;blue&lt;/div&gt;

    CSS selector analogs:

     # [$attribute=$value]
     my $collection = $node-&gt;findAttr($attribute, $value, 0, '=');
 
     # [$attribute=$value i]
     my $collection = $node-&gt;findAttr($attribute, $value, 1, '=');
 
     # [$attribute~=$value]
     my $collection = $node-&gt;findAttr($attribute, $value, 0, '~');
 
     # [$attribute|=$value]
     my $collection = $node-&gt;findAttr($attribute, $value, 0, '|');
 
     # [$attribute*=$value]
     my $collection = $node-&gt;findAttr($attribute, $value, 0, '*');

     # [$attribute^=$value]
     my $collection = $node-&gt;findAttr($attribute, $value, 0, '^');

     # [$attribute$=$value]
     my $collection = $node-&gt;findAttr($attribute, $value, 0, '$');

   getDefaultBoxType
     my $display = $node-&gt;getDefaultBoxType;

    Get default CSS "display" property for tag (useful for functions like a
    innerText).

     my $tree = HTML5::DOM-&gt;new
        -&gt;parse('&lt;div class="red color"&gt;red&lt;/div&gt;&lt;script&gt;alert()&lt;/script&gt;&lt;b&gt;bbb&lt;/b&gt;');
     print $tree-&gt;at('div')-&gt;getDefaultBoxType();       # block
     print $tree-&gt;at('script')-&gt;getDefaultBoxType();    # none
     print $tree-&gt;at('b')-&gt;getDefaultBoxType();         # inline

HTML5::DOM::Document
    DOM node object for document. Inherit all methods from
    HTML5::DOM::Element.

HTML5::DOM::Fragment
    DOM node object for fragments. Inherit all methods from
    HTML5::DOM::Element.

HTML5::DOM::Text
    DOM node object for text. Inherit all methods from HTML5::DOM::Node.

HTML5::DOM::Comment
    DOM node object for comments. Inherit all methods from HTML5::DOM::Node.

HTML5::DOM::DocType
    DOM node object for document type. Inherit all methods from
    HTML5::DOM::Node.

   name
     my $name = $node-&gt;name;
     my $node = $node-&gt;name($new_name);

    Return or change root element name from doctype.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
            &lt;!DOCTYPE svg&gt;
     ');
 
     # get
     print $tree-&gt;document-&gt;firstChild-&gt;name; # svg
 
     # set
     $tree-&gt;document-&gt;firstChild-&gt;name('html');
     print $tree-&gt;document-&gt;firstChild-&gt;html; # &lt;!DOCTYPE html&gt;

   publicId
     my $public_id = $node-&gt;publicId;
     my $node = $node-&gt;publicId($new_public_id);

    Return or change public id from doctype.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
            &lt;!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"&gt;
     ');
 
     # get
     print $tree-&gt;document-&gt;firstChild-&gt;publicId; # -//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN
 
     # set
     print $tree-&gt;document-&gt;firstChild-&gt;publicId('-//W3C//DTD SVG 1.1//EN');
     print $tree-&gt;document-&gt;firstChild-&gt;html; # &lt;!DOCTYPE svg:svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"&gt;

   systemId
     my $system_id = $node-&gt;systemId;
     my $node = $node-&gt;systemId($new_system_id);

    Return or change public id from doctype.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
            &lt;!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"&gt;
     ');
 
     # get
     print $tree-&gt;document-&gt;firstChild-&gt;systemId; # http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd
 
     # set
     print $tree-&gt;document-&gt;firstChild-&gt;systemId('http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd');
     print $tree-&gt;document-&gt;firstChild-&gt;html; # &lt;!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"&gt;

HTML5::DOM::Collection
    CSS Parser object

   new
     my $collection = HTML5::DOM::Collection-&gt;new($nodes);

    Creates new collection from $nodes (reference to array with
    HTML5::DOM::Node).

   each
     $collection-&gt;each(sub {...});
     $collection-&gt;each(sub {...}, @additional_args);

    Foreach all nodes in collection. Returns self.

    Example:

     $collection-&gt;each(sub {
        my ($node, $index) = @_;
        print "FOUND: node[$index] is a '$node'\n";
     });

     # Also can bypass additional arguments
     $collection-&gt;each(sub {
        my ($node, $index, $title) = @_;
        print $title."node[$index] is a '$node'\n";
     }, "FOUND: ");

   map
     my $new_collection = $collection-&gt;map(sub {
        my ($token, $index) = @_;
        return "FOUND: ".$node-&gt;tag." =&gt; $index";
     });

     # Also can bypass additional arguments
     my $new_collection = $collection-&gt;map(sub {
        my ($token, $index, $title) = @_;
        return $title.$node-&gt;tag." =&gt; $index";
     }, "FOUND: ");

    Apply callback for each node in collection. Returns new array from
    results.

     my $new_collection = $collection-&gt;map($method, @args);

    Call method for each node in collection. Returns new
    HTML5::DOM::Collection from results.

    Example:

     # set text 'test!' for all nodes
     $collection-&gt;map('text', 'test!');

     # get all tag names as array
     my $new_collection = $collection-&gt;map('tag');

     # remove all nodes in collection
     $collection-&gt;map('remove');

   add
     my $collection = $collection-&gt;add($node);

    Add new item to collection.

   length
     my $length = $collection-&gt;length;

    Items count in collection.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;OSX&lt;/li&gt;
            &lt;li&gt;Windows&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $collection = $tree-&gt;find('ul li');
     print $collection-&gt;length; # 3

   grep
     my $new_collection = $collection-&gt;grep(qr/regexp/);

    Evaluates regexp for html code of each element in collection and creates
    new collection with all matched elements.

     my $new_collection = $collection-&gt;grep(sub {...});
     my $new_collection = $collection-&gt;grep(sub {...}, @args);

    Evaluates callback foreach element in collection and creates new
    collection with all elements for which callback returned true.

    Example for regexp:

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;OSX (not supported)&lt;/li&gt;
            &lt;li&gt;Windows (not supported)&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $collection = $tree-&gt;find('ul li')-&gt;grep(qr/not supported/);
     print $collection-&gt;length; # 2

    Example for callback:

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;OSX (not supported)&lt;/li&gt;
            &lt;li&gt;Windows (not supported)&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $collection = $tree-&gt;find('ul li')-&gt;grep(sub { $_-&gt;html =~ /not supported/ });
     print $collection-&gt;length; # 2

   first
     my $node = $collection-&gt;first;

    Get first item in collection.

     my $node = $collection-&gt;first(qr/regexp/);

    Get first element in collection which html code matches regexp.

     my $node = $collection-&gt;first(sub {...});
     my $node = $collection-&gt;first(sub {...}, @args);

    Get first element in collection which where callback returned true.

    Example for regexp:

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;OSX (not supported)&lt;/li&gt;
            &lt;li&gt;Windows (not supported)&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $collection = $tree-&gt;find('ul li');
     print $collection-&gt;first-&gt;html; # &lt;li&gt;Linux&lt;/li&gt;
     print $collection-&gt;first(qr/not supported/)-&gt;html; # &lt;li&gt;OSX (not supported)&lt;/li&gt;

    Example for callback:

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;OSX (not supported)&lt;/li&gt;
            &lt;li&gt;Windows (not supported)&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $collection = $tree-&gt;find('ul li');
     print $collection-&gt;first-&gt;html; # &lt;li&gt;Linux&lt;/li&gt;
     print $collection-&gt;first(sub { $_-&gt;html =~ /not supported })-&gt;html; # &lt;li&gt;OSX (not supported)&lt;/li&gt;

   last
     my $node = $collection-&gt;last;

    Get last item in collection.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;OSX&lt;/li&gt;
            &lt;li&gt;Windows&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $collection = $tree-&gt;find('ul li');
     print $collection-&gt;last-&gt;html; # &lt;li&gt;Windows&lt;/li&gt;

   item
     my $node = $collection-&gt;item($index);
     my $node = $collection-&gt;[$index];

    Get item by $index in collection.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;OSX&lt;/li&gt;
            &lt;li&gt;Windows&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $collection = $tree-&gt;find('ul li');
     print $collection-&gt;item(1)-&gt;html;      # &lt;li&gt;OSX&lt;/li&gt;
     print $collection-&gt;[1]-&gt;html;          # &lt;li&gt;OSX&lt;/li&gt;

   reverse
     my $reversed_collection = $collection-&gt;reverse;

    Returns copy of collection in reverse order.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;OSX&lt;/li&gt;
            &lt;li&gt;Windows&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $collection = $tree-&gt;find('ul li');
     print join(', ', @{$collection-&gt;map('text')};            # Linux, OSX, Windows
     print join(', ', @{$collection-&gt;reverse()-&gt;map('text')}; # Windows, OSX, Linux

   shuffle
     my $shuffled_collection = $collection-&gt;shuffle;

    Returns copy of collection in random order.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;OSX&lt;/li&gt;
            &lt;li&gt;Windows&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $collection = $tree-&gt;find('ul li');
     print join(', ', @{$collection-&gt;shuffle()-&gt;map('text')}; # Windows, Linux, OSX
     print join(', ', @{$collection-&gt;shuffle()-&gt;map('text')}; # Windows, OSX, Linux
     print join(', ', @{$collection-&gt;shuffle()-&gt;map('text')}; # OSX, Windows, Linux

   head
     my $new_collection = $collection-&gt;head($length);

    Returns copy of collection with only first $length items.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;OSX&lt;/li&gt;
            &lt;li&gt;Windows&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $collection = $tree-&gt;find('ul li');
     print join(', ', @{$collection-&gt;head(2)-&gt;map('text')}; # Linux, OSX

   tail
     my $new_collection = $collection-&gt;tail($length);

    Returns copy of collection with only last $length items.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;OSX&lt;/li&gt;
            &lt;li&gt;Windows&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $collection = $tree-&gt;find('ul li');
     print join(', ', @{$collection-&gt;tail(2)-&gt;map('text')}; # OSX, Windows

   slice
     my $new_collection = $collection-&gt;slice($offset);

    Returns new collection with sequence by specified $offset.

    If $offset is positive, the sequence will start at that $offset in the
    $collection. If $offset is negative, the sequence will start that far
    from the end of the $collection.

     my $new_collection = $collection-&gt;slice($offset, $length);

    Returns new collection with sequence by specified $offset and $length.

    If $offset is positive, the sequence will start at that $offset in the
    $collection.

    If $offset is negative, the sequence will start that far from the end of
    the $collection.

    If $length is positive, then the sequence will have up to that many
    elements in it.

    If the $collection is shorter than the $length, then only the available
    $collection elements will be present.

    If $length is negative then the sequence will stop that many elements
    from the end of the $collection.

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li&gt;Linux&lt;/li&gt;
            &lt;!-- comment --&gt;
            &lt;li&gt;NetBSD&lt;/li&gt;
            &lt;li&gt;OSX&lt;/li&gt;
            &lt;li&gt;Windows&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $collection = $tree-&gt;find('ul li');
     print join(', ', @{$collection-&gt;slice(1)-&gt;map('text')};      # NetBSD, OSX, Windows
     print join(', ', @{$collection-&gt;slice(1, 2)-&gt;map('text')};   # NetBSD, OSX
     print join(', ', @{$collection-&gt;slice(-2)-&gt;map('text')};     # OSX, Windows
     print join(', ', @{$collection-&gt;slice(-2, 1)-&gt;map('text')};  # OSX
     print join(', ', @{$collection-&gt;slice(-3, -1)-&gt;map('text')}; # NetBSD, OSX

   uniq
     my $new_collection = $collection-&gt;uniq();

    Returns copy of collection with only uniq nodes.

     my $new_collection = $collection-&gt;uniq(sub {...});

    Returns copy of collection with only unique nodes which unique
    identifier of each node returned by callback.

    Example:

     my $tree = HTML5::DOM-&gt;new-&gt;parse('
        &lt;ul&gt;
            &lt;li data-kernel="linux"&gt;Ubuntu&lt;/li&gt;
            &lt;li data-kernel="linux"&gt;Arch Linux&lt;/li&gt;
            &lt;!-- comment --&gt;
            &lt;li data-kernel="darwin"&gt;OSX&lt;/li&gt;
            &lt;li data-kernel="nt"&gt;Windows&lt;/li&gt;
        &lt;/ul&gt;
     ');
     my $collection = $tree-&gt;find('ul li');
     print join(', ', @{$collection-&gt;uniq-&gt;map('text')};                                   # Ubuntu, Arch Linux, OSX, Windows
     print join(', ', @{$collection-&gt;uniq(sub { $_-&gt;attr("data-kernel") })-&gt;map('text')};  # Ubuntu, OSX, Windows

   array
     my $node = $collection-&gt;array();

    Get collection items as array.

   html
     my $html = $collection-&gt;html;

    Concat &lt;outerHTML|/outerHTML&gt; from all items.

   text
     my $text = $collection-&gt;text;

    Concat &lt;textContent|/textContent&gt; from all items.

HTML5::DOM::TokenList
    Similar to
    &lt;https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList&gt;

   has
   contains
     my $flag = $tokens-&gt;has($token);
     my $flag = $tokens-&gt;contains($token); # alias

    Check if token contains in current tokens list.

   add
     my $tokens = $tokens-&gt;add($token);
     my $tokens = $tokens-&gt;add($token, $token2, ...);

    Add new token (or tokens) to current tokens list. Returns self.

   remove
     my $tokens = $tokens-&gt;add($token);
     my $tokens = $tokens-&gt;add($token, $token2, ...);

    Remove one or more tokens from current tokens list. Returns self.

   toggle
     my $state = $tokens-&gt;toggle($token);
     my $state = $tokens-&gt;toggle($token, $force_state);

    *   $token - specified token name

    *   $force_state - optional force state.

        If 1 - similar to add

        If 0 - similar to remove

    Toggle specified token in current tokens list.

    *   If token exists - remove it

    *   If token not exists - add it

   length
     my $length = $tokens-&gt;length;

    Returns tokens count in current list.

   item
     my $token = $tokens-&gt;item($index);
     my $token = $tokens-&gt;[$index];

    Return token by index.

   each
     my $token = $tokens-&gt;each(sub {
        my ($token, $index) = @_;
        print "tokens[$index] is a '$token'\n";
     });

    Forach all tokens in list.

HTML5::DOM::AsyncResult
    Get result and check status from async parsing.

   parsed
    Non-blocking check status.

     use warnings;
     use strict;
     use HTML5::DOM;

     my $parser = HTML5::DOM-&gt;new;
     my $async = $parser-&gt;parseAsync('&lt;div&gt;Hello world!&lt;/div&gt;' x 1000);
 
     my $is_parsed;
     while (!($is_parsed = $async-&gt;parsed)) {
         print "is_parsed=$is_parsed\n";
     }

    Returns 1 if async parsing done. Otherwise returns 0.

   tree
    Non-blocking get result.

     use warnings;
     use strict;
     use HTML5::DOM;

     my $parser = HTML5::DOM-&gt;new;
     my $async = $parser-&gt;parseAsync('&lt;div&gt;Hello world!&lt;/div&gt;' x 1000);
 
     my $tree;
     while (!($tree = $async-&gt;tree)) {
         print "is_parsed=".($tree ? 1 : 0)."\n";
     }
 
     print $tree-&gt;at('div')-&gt;text."\n"; # Hello world!

    Returns HTML5::DOM::Tree object if async parsing done. Otherwise returns
    "undef".

   wait
     use warnings;
     use strict;
     use HTML5::DOM;

     my $parser = HTML5::DOM-&gt;new;
     my $async = $parser-&gt;parseAsync('&lt;div&gt;Hello world!&lt;/div&gt;' x 1000);
 
     my $tree = $async-&gt;wait;
 
     print $tree-&gt;at('div')-&gt;text."\n"; # Hello world!

    Blocking waits for parsing done and returns HTML5::DOM::Tree object.

HTML5::DOM::CSS
    CSS Parser object

   new
     # with default options
     my $css = HTML5::DOM::CSS-&gt;new;

     # or override some options, if you need
     my $css = HTML5::DOM::CSS-&gt;new({
         utf8 =&gt; 0
     });

    Create new css parser object wuth options. See "CSS PARSER OPTIONS" for
    details.

   parseSelector
     my $selector = HTML5::DOM::CSS-&gt;parseSelector($selector_text);

    Parse $selector_text and return HTML5::DOM::CSS::Selector.

     my $css = HTML5::DOM::CSS-&gt;new;
     my $selector = $css-&gt;parseSelector('body div.red, body span.blue');
 
     # with custom options (extends options defined in HTML5::DOM::CSS-&gt;new)
     my $selector = $css-&gt;parseSelector('body div.red, body span.blue', { utf8 =&gt; 0 });

HTML5::DOM::CSS::Selector
    CSS Selector object (precompiled selector)

   new
     my $selector = HTML5::DOM::CSS::Selector-&gt;new($selector_text);

    Parse $selector_text and create new css selector object. If your need
    parse many selectors, more efficient way using single instance of parser
    HTML5::DOM::CSS and parseSelector method.

   text
     my $selector_text = $selector-&gt;text;

    Serialize selector to text.

     my $css = HTML5::DOM::CSS-&gt;new;
     my $selector = $css-&gt;parseSelector('body div.red, body span.blue');
     print $selector-&gt;text."\n"; # body div.red, body span.blue

   ast
     my $ast = $entry-&gt;ast;

    Serialize selector to very simple AST format.

     my $css = HTML5::DOM::CSS-&gt;new;
     my $selector = $css-&gt;parseSelector('div &gt; .red');
     print Dumper($selector-&gt;ast);
 
     # $VAR1 = [[
     #     {
     #         'value' =&gt; 'div',
     #         'type' =&gt; 'tag'
     #     },
     #     {
     #         'type'  =&gt; 'combinator',
     #         'value' =&gt; 'child'
     #     },
     #     {
     #         'type' =&gt; 'class',
     #         'value' =&gt; 'red'
     #     }
     # ]];

   length
     my $length = $selector-&gt;length;

    Get selector entries count (selectors separated by "," combinator)

     my $css = HTML5::DOM::CSS-&gt;new;
     my $selector = $css-&gt;parseSelector('body div.red, body span.blue');
     print $selector-&gt;length."\n"; # 2

   entry
     my $entry = $selector-&gt;entry($index);

    Get selector entry by $index end return
    HTML5::DOM::CSS::Selector::Entry.

     my $css = HTML5::DOM::CSS-&gt;new;
     my $selector = $css-&gt;parseSelector('body div.red, body span.blue');
     print $selector-&gt;entry(0)-&gt;text."\n"; # body div.red
     print $selector-&gt;entry(1)-&gt;text."\n"; # body span.blue

   utf8
    As getter - get 1 if current selector object returns all strings with
    utf8 flag.

    Example with utf8:

     use warnings;
     use strict;
     use HTML5::DOM;
     use utf8;
 
     my $selector = HTML5::DOM::CSS-&gt;new-&gt;parseSelector("[name=\"Ñ‚ÐµÑÑ‚\"]");
     my $is_utf8_enabled = $selector-&gt;utf8;
     print "is_utf8_enabled=".($is_utf8_enabled ? "true" : "false")."\n"; # true

    Or example with bytes:

     use warnings;
     use strict;
     use HTML5::DOM;
 
     my $selector = HTML5::DOM::CSS-&gt;new-&gt;parseSelector("[name=\"Ñ‚ÐµÑÑ‚\"]");
     my $is_utf8_enabled = $selector-&gt;utf8;
     print "is_utf8_enabled=".($is_utf8_enabled ? "true" : "false")."\n"; # false

    As setter - enable or disable utf8 flag on all returned strings.

     use warnings;
     use strict;
     use HTML5::DOM;
     use utf8;
 
     my $selector = HTML5::DOM::CSS-&gt;new-&gt;parseSelector("[name=\"Ñ‚ÐµÑÑ‚\"]");
 
     print "is_utf8_enabled=".($selector-&gt;utf8 ? "true" : "false")."\n"; # true
     print length($selector-&gt;text)." chars\n"; # 13 chars
 
     $selector-&gt;utf8(0);
 
     print "is_utf8_enabled=".($selector-&gt;utf8 ? "true" : "false")."\n"; # false
     print length($selector-&gt;text)." bytes\n"; # 17 bytes

HTML5::DOM::CSS::Selector::Entry
    CSS selector entry object (precompiled selector)

   text
     my $selector_text = $entry-&gt;text;

    Serialize entry to text.

     my $css = HTML5::DOM::CSS-&gt;new;
     my $selector = $css-&gt;parseSelector('body div.red, body span.blue');
     my $entry = $selector-&gt;entry(0);
     print $entry-&gt;text."\n"; # body div.red

   pseudoElement
     my $pseudo_name = $entry-&gt;pseudoElement;

    Return pseudo-element name for entry.

     my $css = HTML5::DOM::CSS-&gt;new;
     my $selector = $css-&gt;parseSelector('div::after');
     my $entry = $selector-&gt;entry(0);
     print $entry-&gt;pseudoElement."\n"; # after

   ast
     my $ast = $entry-&gt;ast;

    Serialize entry to very simple AST format.

     my $css = HTML5::DOM::CSS-&gt;new;
     my $selector = $css-&gt;parseSelector('div &gt; .red');
     my $entry = $selector-&gt;entry(0);
     print Dumper($entry-&gt;ast);
 
     # $VAR1 = [
     #     {
     #         'value' =&gt; 'div',
     #         'type' =&gt; 'tag'
     #     },
     #     {
     #         'type'  =&gt; 'combinator',
     #         'value' =&gt; 'child'
     #     },
     #     {
     #         'type' =&gt; 'class',
     #         'value' =&gt; 'red'
     #     }
     # ];

   specificity
     my $specificity = $entry-&gt;specificity;

    Get specificity in hash "{a, b, c}"

     my $css = HTML5::DOM::CSS-&gt;new;
     my $selector = $css-&gt;parseSelector('body div.red, body span.blue');
     my $entry = $selector-&gt;entry(0);
     print Dumper($entry-&gt;specificity); # {a =&gt; 0, b =&gt; 1, c =&gt; 2}

   specificityArray
     my $specificity = $entry-&gt;specificityArray;

    Get specificity in array "[a, b, c]" (ordered by weight)

     my $css = HTML5::DOM::CSS-&gt;new;
     my $selector = $css-&gt;parseSelector('body div.red, body span.blue');
     my $entry = $selector-&gt;entry(0);
     print Dumper($entry-&gt;specificityArray); # [0, 1, 2]

HTML5::DOM::Encoding
    Encoding detection.

    See for available encodings: "ENCODINGS"

   id2name
     my $encoding = HTML5::DOM::Encoding::id2name($encoding_id);

    Get encoding name by id.

     print HTML5::DOM::Encoding::id2name(HTML5::DOM::Encoding-&gt;UTF_8); # UTF-8

   name2id
     my $encoding_id = HTML5::DOM::Encoding::name2id($encoding);

    Get id by name.

     print HTML5::DOM::Encoding-&gt;UTF_8;             # 0
     print HTML5::DOM::Encoding::id2name("UTF-8");  # 0

   detectAuto
     my ($encoding_id, $new_text) = HTML5::DOM::Encoding::detectAuto($text, $max_length = 0);

    Auto detect text encoding using (in this order):

    *   detectByPrescanStream

    *   detectBomAndCut

    *   detect

    Returns array with encoding id and new text without BOM, if success.

    If fail, then encoding id equal HTML5::DOM::Encoding-&gt;NOT_DETERMINED.

     my ($encoding_id, $new_text) = HTML5::DOM::Encoding::detectAuto("Ð¾Ð»Ð¾Ð»Ð¾");
     my $encoding = HTML5::DOM::Encoding::id2name($encoding_id);
     print $encoding; # UTF-8

   detect
     my $encoding_id = HTML5::DOM::Encoding::detect($text, $max_length = 0);

    Detect text encoding. Single method for both detectCyrillic and
    detectUnicode.

    Returns encoding id, if success. And returns
    HTML5::DOM::Encoding-&gt;NOT_DETERMINED if fail.

     my $encoding_id = HTML5::DOM::Encoding::detect("Ð¾Ð»Ð¾Ð»Ð¾");
     my $encoding = HTML5::DOM::Encoding::id2name($encoding_id);
     print $encoding; # UTF-8

   detectCyrillic
     my $encoding_id = HTML5::DOM::Encoding::detectCyrillic($text, $max_length = 0);

    Detect cyrillic text encoding (using lowercase trigrams), such as
    "windows-1251", "koi8-r", "iso-8859-5", "x-mac-cyrillic", "ibm866".

    Returns encoding id, if success. And returns
    HTML5::DOM::Encoding-&gt;NOT_DETERMINED if fail.

    This method also have aliases for compatibility reasons:
    "detectUkrainian", "detectRussian"

   detectUnicode
     my $encoding_id = HTML5::DOM::Encoding::detectUnicode($text, $max_length = 0);

    Detect unicode family text encoding, such as "UTF-8", "UTF-16LE",
    "UTF-16BE".

    Returns encoding id, if success. And returns
    HTML5::DOM::Encoding-&gt;NOT_DETERMINED if fail.

     # get UTF-16LE data for test
     my $str = "Ð¾Ð»Ð¾Ð»Ð¾";
     Encode::from_to($str, "UTF-8", "UTF-16LE");
 
     my $encoding_id = HTML5::DOM::Encoding::detectUnicode($str);
     my $encoding = HTML5::DOM::Encoding::id2name($encoding_id);
     print $encoding; # UTF-16LE

   detectByPrescanStream
     my $encoding_id = HTML5::DOM::Encoding::detectByPrescanStream($text, $max_length = 0);

    Detect encoding by parsing "&lt;meta&gt;" tags in html.

    Returns encoding id, if success. And returns
    HTML5::DOM::Encoding-&gt;NOT_DETERMINED if fail.

    See for more info:
    &lt;https://html.spec.whatwg.org/multipage/syntax.html#prescan-a-byte-strea
    m-to-determine-its-encoding&gt;

     my $encoding_id = HTML5::DOM::Encoding::detectByPrescanStream('
        &lt;meta http-equiv="content-type" content="text/html; charset=windows-1251"&gt;
     ');
     my $encoding = HTML5::DOM::Encoding::id2name($encoding_id);
     print $encoding; # WINDOWS-1251

   detectByCharset
     my $encoding_id = HTML5::DOM::Encoding::detectByCharset($text, $max_length = 0);

    Extracting character encoding from string. Find "charset=" and see
    encoding. Return found raw data.

    For example: "text/html; charset=windows-1251". Return
    HTML5::DOM::Encoding-&gt;WINDOWS_1251

    And returns HTML5::DOM::Encoding-&gt;NOT_DETERMINED if fail.

    See for more info:
    &lt;https://html.spec.whatwg.org/multipage/infrastructure.html#algorithm-fo
    r-extracting-a-character-encoding-from-a-meta-element&gt;

     my $encoding_id = HTML5::DOM::Encoding::detectByPrescanStream('
        &lt;meta http-equiv="content-type" content="text/html; charset=windows-1251"&gt;
     ');
     my $encoding = HTML5::DOM::Encoding::id2name($encoding_id);
     print $encoding; # WINDOWS-1251

   detectBomAndCut
     my ($encoding_id, $new_text) = HTML5::DOM::Encoding::detectBomAndCut($text, $max_length = 0);

    Returns array with encoding id and new text without BOM.

    If fail, then encoding id equal HTML5::DOM::Encoding-&gt;NOT_DETERMINED.

     my ($encoding_id, $new_text) = HTML5::DOM::Encoding::detectBomAndCut("\xEF\xBB\xBFÐ¾Ð»Ð¾Ð»Ð¾");
     my $encoding = HTML5::DOM::Encoding::id2name($encoding_id);
     print $encoding; # UTF-8
     print $new_text; # Ð¾Ð»Ð¾Ð»Ð¾

NAMESPACES
   Supported namespace names
     html, matml, svg, xlink, xml, xmlns

   Supported namespace id constants
     HTML5::DOM-&gt;NS_UNDEF
     HTML5::DOM-&gt;NS_HTML
     HTML5::DOM-&gt;NS_MATHML
     HTML5::DOM-&gt;NS_SVG
     HTML5::DOM-&gt;NS_XLINK
     HTML5::DOM-&gt;NS_XML
     HTML5::DOM-&gt;NS_XMLNS
     HTML5::DOM-&gt;NS_ANY
     HTML5::DOM-&gt;NS_LAST_ENTRY

TAGS
     HTML5::DOM-&gt;TAG__UNDEF
     HTML5::DOM-&gt;TAG__TEXT
     HTML5::DOM-&gt;TAG__COMMENT
     HTML5::DOM-&gt;TAG__DOCTYPE
     HTML5::DOM-&gt;TAG_A
     HTML5::DOM-&gt;TAG_ABBR
     HTML5::DOM-&gt;TAG_ACRONYM
     HTML5::DOM-&gt;TAG_ADDRESS
     HTML5::DOM-&gt;TAG_ANNOTATION_XML
     HTML5::DOM-&gt;TAG_APPLET
     HTML5::DOM-&gt;TAG_AREA
     HTML5::DOM-&gt;TAG_ARTICLE
     HTML5::DOM-&gt;TAG_ASIDE
     HTML5::DOM-&gt;TAG_AUDIO
     HTML5::DOM-&gt;TAG_B
     HTML5::DOM-&gt;TAG_BASE
     HTML5::DOM-&gt;TAG_BASEFONT
     HTML5::DOM-&gt;TAG_BDI
     HTML5::DOM-&gt;TAG_BDO
     HTML5::DOM-&gt;TAG_BGSOUND
     HTML5::DOM-&gt;TAG_BIG
     HTML5::DOM-&gt;TAG_BLINK
     HTML5::DOM-&gt;TAG_BLOCKQUOTE
     HTML5::DOM-&gt;TAG_BODY
     HTML5::DOM-&gt;TAG_BR
     HTML5::DOM-&gt;TAG_BUTTON
     HTML5::DOM-&gt;TAG_CANVAS
     HTML5::DOM-&gt;TAG_CAPTION
     HTML5::DOM-&gt;TAG_CENTER
     HTML5::DOM-&gt;TAG_CITE
     HTML5::DOM-&gt;TAG_CODE
     HTML5::DOM-&gt;TAG_COL
     HTML5::DOM-&gt;TAG_COLGROUP
     HTML5::DOM-&gt;TAG_COMMAND
     HTML5::DOM-&gt;TAG_COMMENT
     HTML5::DOM-&gt;TAG_DATALIST
     HTML5::DOM-&gt;TAG_DD
     HTML5::DOM-&gt;TAG_DEL
     HTML5::DOM-&gt;TAG_DETAILS
     HTML5::DOM-&gt;TAG_DFN
     HTML5::DOM-&gt;TAG_DIALOG
     HTML5::DOM-&gt;TAG_DIR
     HTML5::DOM-&gt;TAG_DIV
     HTML5::DOM-&gt;TAG_DL
     HTML5::DOM-&gt;TAG_DT
     HTML5::DOM-&gt;TAG_EM
     HTML5::DOM-&gt;TAG_EMBED
     HTML5::DOM-&gt;TAG_FIELDSET
     HTML5::DOM-&gt;TAG_FIGCAPTION
     HTML5::DOM-&gt;TAG_FIGURE
     HTML5::DOM-&gt;TAG_FONT
     HTML5::DOM-&gt;TAG_FOOTER
     HTML5::DOM-&gt;TAG_FORM
     HTML5::DOM-&gt;TAG_FRAME
     HTML5::DOM-&gt;TAG_FRAMESET
     HTML5::DOM-&gt;TAG_H1
     HTML5::DOM-&gt;TAG_H2
     HTML5::DOM-&gt;TAG_H3
     HTML5::DOM-&gt;TAG_H4
     HTML5::DOM-&gt;TAG_H5
     HTML5::DOM-&gt;TAG_H6
     HTML5::DOM-&gt;TAG_HEAD
     HTML5::DOM-&gt;TAG_HEADER
     HTML5::DOM-&gt;TAG_HGROUP
     HTML5::DOM-&gt;TAG_HR
     HTML5::DOM-&gt;TAG_HTML
     HTML5::DOM-&gt;TAG_I
     HTML5::DOM-&gt;TAG_IFRAME
     HTML5::DOM-&gt;TAG_IMAGE
     HTML5::DOM-&gt;TAG_IMG
     HTML5::DOM-&gt;TAG_INPUT
     HTML5::DOM-&gt;TAG_INS
     HTML5::DOM-&gt;TAG_ISINDEX
     HTML5::DOM-&gt;TAG_KBD
     HTML5::DOM-&gt;TAG_KEYGEN
     HTML5::DOM-&gt;TAG_LABEL
     HTML5::DOM-&gt;TAG_LEGEND
     HTML5::DOM-&gt;TAG_LI
     HTML5::DOM-&gt;TAG_LINK
     HTML5::DOM-&gt;TAG_LISTING
     HTML5::DOM-&gt;TAG_MAIN
     HTML5::DOM-&gt;TAG_MAP
     HTML5::DOM-&gt;TAG_MARK
     HTML5::DOM-&gt;TAG_MARQUEE
     HTML5::DOM-&gt;TAG_MENU
     HTML5::DOM-&gt;TAG_MENUITEM
     HTML5::DOM-&gt;TAG_META
     HTML5::DOM-&gt;TAG_METER
     HTML5::DOM-&gt;TAG_MTEXT
     HTML5::DOM-&gt;TAG_NAV
     HTML5::DOM-&gt;TAG_NOBR
     HTML5::DOM-&gt;TAG_NOEMBED
     HTML5::DOM-&gt;TAG_NOFRAMES
     HTML5::DOM-&gt;TAG_NOSCRIPT
     HTML5::DOM-&gt;TAG_OBJECT
     HTML5::DOM-&gt;TAG_OL
     HTML5::DOM-&gt;TAG_OPTGROUP
     HTML5::DOM-&gt;TAG_OPTION
     HTML5::DOM-&gt;TAG_OUTPUT
     HTML5::DOM-&gt;TAG_P
     HTML5::DOM-&gt;TAG_PARAM
     HTML5::DOM-&gt;TAG_PLAINTEXT
     HTML5::DOM-&gt;TAG_PRE
     HTML5::DOM-&gt;TAG_PROGRESS
     HTML5::DOM-&gt;TAG_Q
     HTML5::DOM-&gt;TAG_RB
     HTML5::DOM-&gt;TAG_RP
     HTML5::DOM-&gt;TAG_RT
     HTML5::DOM-&gt;TAG_RTC
     HTML5::DOM-&gt;TAG_RUBY
     HTML5::DOM-&gt;TAG_S
     HTML5::DOM-&gt;TAG_SAMP
     HTML5::DOM-&gt;TAG_SCRIPT
     HTML5::DOM-&gt;TAG_SECTION
     HTML5::DOM-&gt;TAG_SELECT
     HTML5::DOM-&gt;TAG_SMALL
     HTML5::DOM-&gt;TAG_SOURCE
     HTML5::DOM-&gt;TAG_SPAN
     HTML5::DOM-&gt;TAG_STRIKE
     HTML5::DOM-&gt;TAG_STRONG
     HTML5::DOM-&gt;TAG_STYLE
     HTML5::DOM-&gt;TAG_SUB
     HTML5::DOM-&gt;TAG_SUMMARY
     HTML5::DOM-&gt;TAG_SUP
     HTML5::DOM-&gt;TAG_SVG
     HTML5::DOM-&gt;TAG_TABLE
     HTML5::DOM-&gt;TAG_TBODY
     HTML5::DOM-&gt;TAG_TD
     HTML5::DOM-&gt;TAG_TEMPLATE
     HTML5::DOM-&gt;TAG_TEXTAREA
     HTML5::DOM-&gt;TAG_TFOOT
     HTML5::DOM-&gt;TAG_TH
     HTML5::DOM-&gt;TAG_THEAD
     HTML5::DOM-&gt;TAG_TIME
     HTML5::DOM-&gt;TAG_TITLE
     HTML5::DOM-&gt;TAG_TR
     HTML5::DOM-&gt;TAG_TRACK
     HTML5::DOM-&gt;TAG_TT
     HTML5::DOM-&gt;TAG_U
     HTML5::DOM-&gt;TAG_UL
     HTML5::DOM-&gt;TAG_VAR
     HTML5::DOM-&gt;TAG_VIDEO
     HTML5::DOM-&gt;TAG_WBR
     HTML5::DOM-&gt;TAG_XMP
     HTML5::DOM-&gt;TAG_ALTGLYPH
     HTML5::DOM-&gt;TAG_ALTGLYPHDEF
     HTML5::DOM-&gt;TAG_ALTGLYPHITEM
     HTML5::DOM-&gt;TAG_ANIMATE
     HTML5::DOM-&gt;TAG_ANIMATECOLOR
     HTML5::DOM-&gt;TAG_ANIMATEMOTION
     HTML5::DOM-&gt;TAG_ANIMATETRANSFORM
     HTML5::DOM-&gt;TAG_CIRCLE
     HTML5::DOM-&gt;TAG_CLIPPATH
     HTML5::DOM-&gt;TAG_COLOR_PROFILE
     HTML5::DOM-&gt;TAG_CURSOR
     HTML5::DOM-&gt;TAG_DEFS
     HTML5::DOM-&gt;TAG_DESC
     HTML5::DOM-&gt;TAG_ELLIPSE
     HTML5::DOM-&gt;TAG_FEBLEND
     HTML5::DOM-&gt;TAG_FECOLORMATRIX
     HTML5::DOM-&gt;TAG_FECOMPONENTTRANSFER
     HTML5::DOM-&gt;TAG_FECOMPOSITE
     HTML5::DOM-&gt;TAG_FECONVOLVEMATRIX
     HTML5::DOM-&gt;TAG_FEDIFFUSELIGHTING
     HTML5::DOM-&gt;TAG_FEDISPLACEMENTMAP
     HTML5::DOM-&gt;TAG_FEDISTANTLIGHT
     HTML5::DOM-&gt;TAG_FEDROPSHADOW
     HTML5::DOM-&gt;TAG_FEFLOOD
     HTML5::DOM-&gt;TAG_FEFUNCA
     HTML5::DOM-&gt;TAG_FEFUNCB
     HTML5::DOM-&gt;TAG_FEFUNCG
     HTML5::DOM-&gt;TAG_FEFUNCR
     HTML5::DOM-&gt;TAG_FEGAUSSIANBLUR
     HTML5::DOM-&gt;TAG_FEIMAGE
     HTML5::DOM-&gt;TAG_FEMERGE
     HTML5::DOM-&gt;TAG_FEMERGENODE
     HTML5::DOM-&gt;TAG_FEMORPHOLOGY
     HTML5::DOM-&gt;TAG_FEOFFSET
     HTML5::DOM-&gt;TAG_FEPOINTLIGHT
     HTML5::DOM-&gt;TAG_FESPECULARLIGHTING
     HTML5::DOM-&gt;TAG_FESPOTLIGHT
     HTML5::DOM-&gt;TAG_FETILE
     HTML5::DOM-&gt;TAG_FETURBULENCE
     HTML5::DOM-&gt;TAG_FILTER
     HTML5::DOM-&gt;TAG_FONT_FACE
     HTML5::DOM-&gt;TAG_FONT_FACE_FORMAT
     HTML5::DOM-&gt;TAG_FONT_FACE_NAME
     HTML5::DOM-&gt;TAG_FONT_FACE_SRC
     HTML5::DOM-&gt;TAG_FONT_FACE_URI
     HTML5::DOM-&gt;TAG_FOREIGNOBJECT
     HTML5::DOM-&gt;TAG_G
     HTML5::DOM-&gt;TAG_GLYPH
     HTML5::DOM-&gt;TAG_GLYPHREF
     HTML5::DOM-&gt;TAG_HKERN
     HTML5::DOM-&gt;TAG_LINE
     HTML5::DOM-&gt;TAG_LINEARGRADIENT
     HTML5::DOM-&gt;TAG_MARKER
     HTML5::DOM-&gt;TAG_MASK
     HTML5::DOM-&gt;TAG_METADATA
     HTML5::DOM-&gt;TAG_MISSING_GLYPH
     HTML5::DOM-&gt;TAG_MPATH
     HTML5::DOM-&gt;TAG_PATH
     HTML5::DOM-&gt;TAG_PATTERN
     HTML5::DOM-&gt;TAG_POLYGON
     HTML5::DOM-&gt;TAG_POLYLINE
     HTML5::DOM-&gt;TAG_RADIALGRADIENT
     HTML5::DOM-&gt;TAG_RECT
     HTML5::DOM-&gt;TAG_SET
     HTML5::DOM-&gt;TAG_STOP
     HTML5::DOM-&gt;TAG_SWITCH
     HTML5::DOM-&gt;TAG_SYMBOL
     HTML5::DOM-&gt;TAG_TEXT
     HTML5::DOM-&gt;TAG_TEXTPATH
     HTML5::DOM-&gt;TAG_TREF
     HTML5::DOM-&gt;TAG_TSPAN
     HTML5::DOM-&gt;TAG_USE
     HTML5::DOM-&gt;TAG_VIEW
     HTML5::DOM-&gt;TAG_VKERN
     HTML5::DOM-&gt;TAG_MATH
     HTML5::DOM-&gt;TAG_MACTION
     HTML5::DOM-&gt;TAG_MALIGNGROUP
     HTML5::DOM-&gt;TAG_MALIGNMARK
     HTML5::DOM-&gt;TAG_MENCLOSE
     HTML5::DOM-&gt;TAG_MERROR
     HTML5::DOM-&gt;TAG_MFENCED
     HTML5::DOM-&gt;TAG_MFRAC
     HTML5::DOM-&gt;TAG_MGLYPH
     HTML5::DOM-&gt;TAG_MI
     HTML5::DOM-&gt;TAG_MLABELEDTR
     HTML5::DOM-&gt;TAG_MLONGDIV
     HTML5::DOM-&gt;TAG_MMULTISCRIPTS
     HTML5::DOM-&gt;TAG_MN
     HTML5::DOM-&gt;TAG_MO
     HTML5::DOM-&gt;TAG_MOVER
     HTML5::DOM-&gt;TAG_MPADDED
     HTML5::DOM-&gt;TAG_MPHANTOM
     HTML5::DOM-&gt;TAG_MROOT
     HTML5::DOM-&gt;TAG_MROW
     HTML5::DOM-&gt;TAG_MS
     HTML5::DOM-&gt;TAG_MSCARRIES
     HTML5::DOM-&gt;TAG_MSCARRY
     HTML5::DOM-&gt;TAG_MSGROUP
     HTML5::DOM-&gt;TAG_MSLINE
     HTML5::DOM-&gt;TAG_MSPACE
     HTML5::DOM-&gt;TAG_MSQRT
     HTML5::DOM-&gt;TAG_MSROW
     HTML5::DOM-&gt;TAG_MSTACK
     HTML5::DOM-&gt;TAG_MSTYLE
     HTML5::DOM-&gt;TAG_MSUB
     HTML5::DOM-&gt;TAG_MSUP
     HTML5::DOM-&gt;TAG_MSUBSUP
     HTML5::DOM-&gt;TAG__END_OF_FILE
     HTML5::DOM-&gt;TAG_LAST_ENTRY

ENCODINGS
   Supported encoding names
     AUTO, NOT-DETERMINED, X-USER-DEFINED, 
     BIG5, EUC-JP, EUC-KR, GB18030, GBK, IBM866, MACINTOSH, X-MAC-CYRILLIC, SHIFT_JIS, 
     ISO-2022-JP, ISO-8859-10, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16, ISO-8859-2, 
     ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-8-I, 
     WINDOWS-1250, WINDOWS-1251, WINDOWS-1252, WINDOWS-1253, WINDOWS-1254, 
     WINDOWS-1255, WINDOWS-1256, WINDOWS-1257, WINDOWS-1258, WINDOWS-874, 
     UTF-8, UTF-16BE, UTF-16LE, KOI8-R, KOI8-U

   Supported encoding id consts
     HTML5::DOM::Encoding-&gt;DEFAULT
     HTML5::DOM::Encoding-&gt;AUTO
     HTML5::DOM::Encoding-&gt;NOT_DETERMINED
     HTML5::DOM::Encoding-&gt;UTF_8
     HTML5::DOM::Encoding-&gt;UTF_16LE
     HTML5::DOM::Encoding-&gt;UTF_16BE
     HTML5::DOM::Encoding-&gt;X_USER_DEFINED
     HTML5::DOM::Encoding-&gt;BIG5
     HTML5::DOM::Encoding-&gt;EUC_JP
     HTML5::DOM::Encoding-&gt;EUC_KR
     HTML5::DOM::Encoding-&gt;GB18030
     HTML5::DOM::Encoding-&gt;GBK
     HTML5::DOM::Encoding-&gt;IBM866
     HTML5::DOM::Encoding-&gt;ISO_2022_JP
     HTML5::DOM::Encoding-&gt;ISO_8859_10
     HTML5::DOM::Encoding-&gt;ISO_8859_13
     HTML5::DOM::Encoding-&gt;ISO_8859_14
     HTML5::DOM::Encoding-&gt;ISO_8859_15
     HTML5::DOM::Encoding-&gt;ISO_8859_16
     HTML5::DOM::Encoding-&gt;ISO_8859_2
     HTML5::DOM::Encoding-&gt;ISO_8859_3
     HTML5::DOM::Encoding-&gt;ISO_8859_4
     HTML5::DOM::Encoding-&gt;ISO_8859_5
     HTML5::DOM::Encoding-&gt;ISO_8859_6
     HTML5::DOM::Encoding-&gt;ISO_8859_7
     HTML5::DOM::Encoding-&gt;ISO_8859_8
     HTML5::DOM::Encoding-&gt;ISO_8859_8_I
     HTML5::DOM::Encoding-&gt;KOI8_R
     HTML5::DOM::Encoding-&gt;KOI8_U
     HTML5::DOM::Encoding-&gt;MACINTOSH
     HTML5::DOM::Encoding-&gt;SHIFT_JIS
     HTML5::DOM::Encoding-&gt;WINDOWS_1250
     HTML5::DOM::Encoding-&gt;WINDOWS_1251
     HTML5::DOM::Encoding-&gt;WINDOWS_1252
     HTML5::DOM::Encoding-&gt;WINDOWS_1253
     HTML5::DOM::Encoding-&gt;WINDOWS_1254
     HTML5::DOM::Encoding-&gt;WINDOWS_1255
     HTML5::DOM::Encoding-&gt;WINDOWS_1256
     HTML5::DOM::Encoding-&gt;WINDOWS_1257
     HTML5::DOM::Encoding-&gt;WINDOWS_1258
     HTML5::DOM::Encoding-&gt;WINDOWS_874
     HTML5::DOM::Encoding-&gt;X_MAC_CYRILLIC
     HTML5::DOM::Encoding-&gt;LAST_ENTRY

PARSER OPTIONS
    Options for:

    *   HTML5::DOM::new

    *   HTML5::DOM::parse

    *   HTML5::DOM::parseChunkEnd

    *   HTML5::DOM::Tree::parseFragment

   threads
    Threads count, if &lt; 2 - parsing in single mode without threads (default
    0)

    This option affects only for HTML5::DOM::new.

    Originaly, MyHTML
    &lt;https://github.com/lexborisov/myhtml/blob/master/LICENSE&gt; can use
    mulithread parsing.

    But in real cases this mode slower than single mode (threads=0). Result
    speed very OS-specific and depends on input html.

    Not recommended use if don't known what you do. Single mode faster in
    99.9% cases.

   ignore_whitespace
    Ignore whitespace tokens (default 0)

   ignore_doctype
    Do not parse DOCTYPE (default 0)

   scripts
    If 1 - &lt;noscript&gt; contents parsed to single text node (default)

    If 0 - &lt;noscript&gt; contents parsed to child nodes

   encoding
    Encoding of input HTML, if "auto" - library can tree to automaticaly
    determine encoding. (default "auto")

    Allowed both encoding name or id.

   default_encoding
    Default encoding, this affects only if "encoding" set to "auto" and
    encoding not determined. (default "UTF-8")

    Allowed both encoding name or id.

    See for available encodings: "ENCODINGS"

   encoding_use_meta
    Allow use "&lt;meta&gt;" tags to determine input HTML encoding. (default 1)

    See detectByPrescanStream.

   encoding_prescan_limit
    Limit string length to determine encoding by "&lt;meta&gt;" tags. (default
    1024, from spec)

    See detectByPrescanStream.

   encoding_use_bom
    Allow use detecding BOM to determine input HTML encoding. (default 1)

    See detectBomAndCut.

   utf8
    Default: "auto"

    If 1, then all returned strings have utf8 flag (chars).

    If 0, then all returned strings haven't utf8 flag (bytes).

    If "auto", then utf8 flag detected by input string. Automaticaly enables
    "utf8=1" if input string have utf8 flag.

    "auto" works only in parse, parseChunk, parseAsync methods.

CSS PARSER OPTIONS
    Options for:

    *   HTML5::DOM::CSS::new

    *   HTML5::DOM::CSS::parseSelector

   utf8
    Default: "auto"

    If 1, then all returned strings have utf8 flag (chars).

    If 0, then all returned strings haven't utf8 flag (bytes).

    If "auto", then utf8 flag detected by input string. Automaticaly enables
    "utf8=1" if input string have utf8 flag.

HTML5 SUPPORT
    Tested with html5lib-tests &lt;https://github.com/html5lib/html5lib-tests&gt;
    (at 2021-06-26)

     -------------------------------------------------------------
     test                        total    ok      fail    skip
     -------------------------------------------------------------
     foreign-fragment.dat        66       54      12      0
     tests26.dat                 19       16      3       0
     menuitem-element.dat        19       16      3       0
     tests11.dat                 12       11      1       0
     tests1.dat                  112      112     0       0
     tests4.dat                  6        6       0       0
     tests6.dat                  51       51      0       0
     ruby.dat                    20       20      0       0
     adoption01.dat              17       17      0       0
     tests14.dat                 6        6       0       0
     tests19.dat                 104      104     0       0
     tests7.dat                  30       30      0       0
     noscript01.dat              17       17      0       0
     tests17.dat                 12       12      0       0
     tests23.dat                 4        4       0       0
     pending-spec-changes.dat    2        2       0       0
     tables01.dat                16       16      0       0
     entities02.dat              25       25      0       0
     tests22.dat                 4        4       0       0
     tests10.dat                 53       53      0       0
     tests15.dat                 13       13      0       0
     inbody01.dat                3        3       0       0
     template.dat                107      107     0       0
     plain-text-unsafe.dat       32       32      0       0
     comments01.dat              15       15      0       0
     scriptdata01.dat            26       26      0       0
     svg.dat                     7        7       0       0
     tests25.dat                 25       25      0       0
     tests3.dat                  23       23      0       0
     tests20.dat                 43       43      0       0
     tests12.dat                 1        1       0       0
     tests21.dat                 24       24      0       0
     math.dat                    7        7       0       0
     webkit01.dat                49       49      0       0
     main-element.dat            2        2       0       0
     adoption02.dat              1        1       0       0
     domjs-unsafe.dat            48       48      0       0
     tests16.dat                 196      196     0       0
     blocks.dat                  47       47      0       0
     tests5.dat                  16       16      0       0
     tests8.dat                  9        9       0       0
     tricky01.dat                8        8       0       0
     tests18.dat                 35       35      0       0
     webkit02.dat                20       20      0       0
     tests24.dat                 7        7       0       0
     html5test-com.dat           23       23      0       0
     isindex.dat                 3        3       0       0
     doctype01.dat               36       36      0       0
     entities01.dat              74       74      0       0
     tests2.dat                  61       61      0       0
     tests9.dat                  26       26      0       0
     tests_innerHTML_1.dat       84       84      0       0
     summary                     1666     1647    19      0

    Tested with "examples/html5lib_tests.pl"

     perl examples/html5lib_tests.pl --dir=../html5lib-tests/tree-construction --colordiff

    Send patches to lexborisov's MyHTML
    &lt;https://github.com/lexborisov/myhtml&gt; if you want improve this result.

WORK WITH UTF8
    In normal cases you must don't care about utf8. Everything works out of
    the box.

    By default utf8 mode enabled automaticaly if you specify string with
    utf8 flag.

    For example:

    Perfect work with "use utf8":

     use warnings;
     use strict;
     use HTML5::DOM;
     use utf8;
 
     my $parser = HTML5::DOM-&gt;new;
     my $str = HTML5::DOM-&gt;new-&gt;parse('&lt;b&gt;Ñ‚ÐµÑÑ‚ Ñ‚ÐµÑÑ‚&lt;/b&gt;')-&gt;at('b')-&gt;text;
     print "length=".length($str)." [$str]\n"; # length=9 [Ñ‚ÐµÑÑ‚ Ñ‚ÐµÑÑ‚]

    Perfect work without "use utf8":

     use warnings;
     use strict;
     use HTML5::DOM;
 
     # Perfect work with default mode of perl strings (bytes)
     my $parser = HTML5::DOM-&gt;new;
     my $str = HTML5::DOM-&gt;new-&gt;parse('&lt;b&gt;Ñ‚ÐµÑÑ‚ Ñ‚ÐµÑÑ‚&lt;/b&gt;')-&gt;at('b')-&gt;text;
     print "length=".length($str)." [$str]\n"; # length=17 [Ñ‚ÐµÑÑ‚ Ñ‚ÐµÑÑ‚]

     # You can pass string with utf8 flag without "use utf8" and it perfect works
     use Encode;
     my $test = '&lt;b&gt;Ñ‚ÐµÑÑ‚ Ñ‚ÐµÑÑ‚&lt;/b&gt;';
     Encode::_utf8_on($test);
 
     $str = HTML5::DOM-&gt;new-&gt;parse($test)-&gt;at('b')-&gt;text;
     print "length=".length($str)." [$str]\n"; # length=9 [Ñ‚ÐµÑÑ‚ Ñ‚ÐµÑÑ‚]

    But you can override this behavior - see "PARSER OPTIONS" for details.

    Force use bytes:

     use warnings;
     use strict;
     use HTML5::DOM;
     use utf8;
 
     my $parser = HTML5::DOM-&gt;new({ utf8 =&gt; 0 });
     my $str = $parser-&gt;parse('&lt;b&gt;Ñ‚ÐµÑÑ‚ Ñ‚ÐµÑÑ‚&lt;/b&gt;')-&gt;at('b')-&gt;text;
     print "length=".length($str)." [$str]\n"; # length=17 [Ñ‚ÐµÑÑ‚ Ñ‚ÐµÑÑ‚]

    Force use utf8:

     use warnings;
     use strict;
     use HTML5::DOM;
 
     my $parser = HTML5::DOM-&gt;new({ utf8 =&gt; 1 });
     my $str = $parser-&gt;parse('&lt;b&gt;Ñ‚ÐµÑÑ‚ Ñ‚ÐµÑÑ‚&lt;/b&gt;')-&gt;at('b')-&gt;text;
     print "length=".length($str)." [$str]\n"; # length=13 [Ñ‚ÐµÑÑ‚ Ñ‚ÐµÑÑ‚]

BUGS
    &lt;https://github.com/Azq2/perl-html5-dom/issues&gt;

SEE ALSO
    *   HTML::MyHTML &lt;https://metacpan.org/pod/HTML::MyHTML&gt; - more
        low-level myhtml bindings.

    *   Mojo::DOM &lt;https://metacpan.org/pod/Mojo::DOM&gt; - pure perl HTML5 DOM
        library with CSS selectors.

AUTHOR
    Kirill Zhumarin &lt;kirill.zhumarin@gmail.com&gt;

LICENSE
    *   HTML5::DOM - MIT
        &lt;https://github.com/Azq2/perl-html5-dom/blob/master/LICENSE&gt;

    *   Modest - LGPL 2.1
        &lt;https://github.com/lexborisov/Modest/blob/master/LICENSE&gt;

    *   MyHTML - LGPL 2.1
        &lt;https://github.com/lexborisov/myhtml/blob/master/LICENSE&gt;

    *   MyCSS - LGPL 2.1
        &lt;https://github.com/lexborisov/mycss/blob/master/LICENSE&gt;

</pre></body></html>