Branch Coverage

lib/HTML/Object/DOM/Node.pm
Criterion Covered Total %
branch 156 534 29.2


line true false branch
86 0 347 unless $self->HTML::Object::Element::init(@_)
93 0 7 if scalar @_ < 1
102 0 7 if ($new_parent and not $self->_is_a($new_parent, 'HTML::Object::DOM::Document') and not $self->_is_a($new_parent, 'HTML::Object::DOM::DocumentFragment') and not $self->_is_a($new_parent, 'HTML::Object::DOM::Element')) { }
0 7 elsif (not $self->_is_a($new, 'HTML::Object::DOM::DocumentFragment') || $self->_is_a($new, 'HTML::Object::DOM::Declaration') || $self->_is_a($new, 'HTML::Object::DOM::Element') || $self->_is_a($new, 'HTML::Object::DOM::CharacterData')) { }
0 7 elsif ($self->lineage->has($new)) { }
0 7 elsif ($self->_is_a($new, 'HTML::Object::DOM::Text') || $self->_is_a($new, 'HTML::Object::DOM::Space') and $self->_is_a($new_parent, 'HTML::Object::DOM::Document')) { }
0 7 elsif ($self->isa('HTML::Object::DOM::Declaration') and not $self->_is_a($parent, 'HTML::Object::DOM::Document')) { }
0 7 elsif ($self->_is_a($parent, 'HTML::Object::DOM::Document') and $self->_is_a($new, 'HTML::Object::DOM::DocumentFragment') and $new->childElementCount > 1 || $new->children->grep(sub {
0 7 elsif ($self->_is_a($parent, 'HTML::Object::DOM::Document') and $parent->childElementCount > 0 and $self->_is_a($new, 'HTML::Object::DOM::Element')) { }
0 14 elsif ($self->_is_a($new, 'HTML::Object::DOM::Declaration') and $self->_is_a($nodes->last, 'HTML::Object::DOM::Element')) { }
175 0 7 $self->_is_a($new, 'HTML::Object::DOM::DocumentFragment') ? :
178 0 7 unless $self->_is_a($_, "HTML::Object::DOM::Node")
183 0 7 if ($self->_is_a($new, "HTML::Object::DOM::DocumentFragment"))
196 0 0 if ($self->_is_a($this, "HTML::Object::DOM::Node"))
212 0 1 unless $root
213 0 1 unless $root->can("uri")
214 0 1 if $root->uri
216 0 1 if $nodes->is_empty
218 0 1 unless $node
219 0 1 unless $node->attributes->has("href")
221 0 1 unless defined $uri and length "$uri"
229 0 0 unless $root
232 0 0 if ($nodes->is_empty) { }
243 0 0 unless $base->href($uri)
262 0 10 unless $self->_is_a($elem, "HTML::Object::Element")
282 1 9 if &Scalar::Util::refaddr($self) eq &Scalar::Util::refaddr($elem)
286 1 8 if ($self->nodeType == 2 and $elem->nodeType == 2)
289 1 0 if $self->ownerElement and $self->ownerElement eq $elem->ownerElement
296 0 0 unless ($parent or $parent2)
298 0 0 $self->nodeType < $elem->nodeType ? :
304 1 7 if ($root ne $root2)
320 0 99 if ++$seen->{$addr} > 1
324 2 56 if ($_->can("eid") and defined $_->eid and defined $elem->eid and $_->eid eq $elem->eid)
331 0 56 if (my $e = &$crawl($_))
344 2 5 if (defined $parent_pos and defined $parent2_pos) { }
4 1 elsif (defined $parent_pos) { }
1 0 elsif (defined $parent2_pos) { }
346 0 2 if ($parent_pos > $parent2_pos) { }
0 2 elsif ($parent2_pos > $parent_pos) { }
371 0 7 if ($lineage->intersection($lineage2)->is_empty and $lineage2->intersection($lineage)->is_empty) { }
387 1 6 if ($lineage->has($elem)) { }
1 5 elsif ($prev_siblings->has($elem)) { }
403 1 11 if (my $e = &$crawl($_))
411 4 1 unless ($bit & 2)
419 0 10 if ($ancestor_siblings and $ancestor_siblings->has($elem))
437 2 5 if ($lineage2->has($self)) { }
1 4 elsif ($next_siblings->has($elem)) { }
0 4 elsif (my $e = &$crawl($self)) { }
459 1 26 if (my $e = &$crawl($_))
467 2 2 unless ($bit & 4)
475 0 5 if ($ancestor_siblings and $ancestor_siblings->has($elem))
490 0 2 unless $self->_is_a($elem, "HTML::Object::Element")
492 0 2 if &Scalar::Util::refaddr($self) eq &Scalar::Util::refaddr($elem)
499 0 40 unless defined $e and length $e
501 0 40 if exists $seen->{$addr}
505 2 38 if ($_->eid eq $elem->eid)
526 0 19 if (ref $this and $self->_is_object($this) and $this->isa('HTML::Object::DOM::Element')) { }
539 0 0 if ($child->eid eq $candidate->eid)
546 0 0 if ($child->children->length > 0)
558 0 0 if (ref $this and !overload::Overloaded($this) || overload::Overloaded($this) && !overload::Method($this, '""'))
584 0 19 if ($INC{'threads.pm'} and not exists $INC{'forks.pm'})
589 0 0 if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
0 0 &$Nice::Try::TRY ? :
0 0 if scalar @Nice::Try::VOID
0 0 if ($Nice::Try::WANT eq 'OBJECT') { }
0 0 elsif ($Nice::Try::WANT eq 'CODE') { }
0 0 elsif ($Nice::Try::WANT eq 'HASH') { }
0 0 elsif ($Nice::Try::WANT eq 'ARRAY') { }
0 0 elsif ($Nice::Try::WANT eq 'REFSCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'GLOB') { }
0 0 elsif ($Nice::Try::WANT eq 'LIST') { }
0 0 elsif ($Nice::Try::WANT eq 'BOOLEAN') { }
0 0 elsif ($Nice::Try::WANT eq 'VOID') { }
0 0 elsif ($Nice::Try::WANT eq 'SCALAR') { }
0 0 if defined $Nice::Try::LAST_VAL
0 19 if ($Nice::Try::WANTARRAY) { }
19 0 elsif (defined $Nice::Try::WANTARRAY) { }
0 19 if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { }
0 19 length $@ ? :
19 0 unless &Scalar::Util::blessed($@)
0 0 if ($Nice::Try::HAS_CATCH)
0 19 if ($Nice::Try::DIED)
593 0 0 if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
0 0 &$Nice::Try::CATCH ? :
0 0 if scalar @Nice::Try::VOID
0 0 if ($Nice::Try::WANT eq 'OBJECT') { }
0 0 elsif ($Nice::Try::WANT eq 'CODE') { }
0 0 elsif ($Nice::Try::WANT eq 'HASH') { }
0 0 elsif ($Nice::Try::WANT eq 'ARRAY') { }
0 0 elsif ($Nice::Try::WANT eq 'REFSCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'GLOB') { }
0 0 elsif ($Nice::Try::WANT eq 'LIST') { }
0 0 elsif ($Nice::Try::WANT eq 'BOOLEAN') { }
0 0 elsif ($Nice::Try::WANT eq 'VOID') { }
0 0 elsif ($Nice::Try::WANT eq 'SCALAR') { }
0 0 if ($Nice::Try::WANTARRAY) { }
0 0 elsif (defined $Nice::Try::WANTARRAY) { }
0 0 if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { }
0 0 if $@
0 19 if (defined $Nice::Try::CATCH_DIED)
0 0 if (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__NEXT__') { }
0 0 elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__LAST__') { }
0 0 elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__REDO__') { }
0 0 elsif (defined $Nice::Try::BREAK and $Nice::Try::BREAK eq 'return') { }
0 0 if ($Nice::Try::WANT eq 'LIST') { }
0 0 elsif ($Nice::Try::WANT eq 'VOID') { }
0 0 elsif ($Nice::Try::WANT eq 'OBJECT') { }
0 0 elsif ($Nice::Try::WANT eq 'REFSCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'SCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'BOOLEAN') { }
0 0 elsif ($Nice::Try::WANT eq 'CODE') { }
0 0 elsif ($Nice::Try::WANT eq 'HASH') { }
0 0 elsif ($Nice::Try::WANT eq 'ARRAY') { }
0 0 elsif ($Nice::Try::WANT eq 'GLOB') { }
0 0 $Nice::Try::WANTARRAY ? :
0 0 if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { }
0 0 if (not defined $Nice::Try::BREAK or $Nice::Try::BREAK eq "return")
0 0 scalar @Nice::Try::VOID > 1 ? :
0 19 if (defined $Nice::Try::WANTARRAY || defined $Nice::Try::BREAK && $Nice::Try::BREAK eq 'return' and !&Scalar::Util::blessed($Nice::Try::RETVAL[0]) || &Scalar::Util::blessed($Nice::Try::RETVAL[0]) && !$Nice::Try::RETVAL[0]->isa('Nice::Try::SENTINEL')) { }
0 19 elsif (scalar @Nice::Try::VOID and !&Scalar::Util::blessed($Nice::Try::VOID[0]) || &Scalar::Util::blessed($Nice::Try::VOID[0]) && !$Nice::Try::VOID[0]->isa('Nice::Try::SENTINEL')) { }
0 0 if ($Nice::Try::BREAK eq 'next') { }
0 0 elsif ($Nice::Try::BREAK eq 'last') { }
0 0 elsif ($Nice::Try::BREAK eq 'redo') { }
0 19 if (defined $Nice::Try::BREAK)
0 19 scalar @Nice::Try::LAST_VAL > 1 ? :
650 0 36 wantarray ? :
657 430 123 wantarray ? :
691 0 0 unless $self->_is_a($e, "HTML::Object::DOM::Node")
698 0 0 if (not defined $refNode) { }
704 0 0 unless $self->_is_a($refNode, "HTML::Object::DOM::Node")
709 0 0 unless defined $pos
713 0 0 if $pos < 0
715 0 0 $self->_is_a($e, 'HTML::Object::DOM::DocumentFragment') ? :
723 0 0 if ($self->_is_a($e, "HTML::Object::DOM::DocumentFragment"))
734 0 2 unless $self->_is_a($e, "HTML::Object::DOM::Node")
741 0 2 if (not defined $refNode) { }
747 0 2 unless $self->_is_a($refNode, "HTML::Object::DOM::Node")
752 0 2 unless defined $pos
756 0 2 if $pos < 0
758 0 2 $self->_is_a($e, 'HTML::Object::DOM::DocumentFragment') ? :
766 0 2 if ($self->_is_a($e, "HTML::Object::DOM::DocumentFragment"))
782 0 1 unless $root
783 1 0 $root->isa('HTML::Object::Document') ? :
790 0 0 unless defined $uri
791 0 0 if ($self->tag eq 'svg') { }
805 0 1 unless $self->_is_a($e, "HTML::Object::Element")
806 0 1 if $self->nodeType != $e->nodeType
807 0 1 if $self->children->length != $e->children->length
808 0 1 if $self->attributes_sequence->join(",") ne $e->attributes_sequence->join(",")
814 0 3 if ($v1 ne $v2)
820 0 1 if $failed
834 0 107 unless defined $_[1]
835 44 63 unless ($_[0]->_is_a($_[1], "HTML::Object::DOM::Node"))
837 0 44 if $_[0]->_warnings_is_enabled
852 0 0 if lc $prefix eq "xml"
861 0 0 unless $self->_load_class("HTML::Object::DOM::Closing")
870 0 0 unless $self->_load_class("HTML::Object::DOM::Comment")
879 0 0 unless $self->_load_class("HTML::Object::DOM::Element")
888 0 0 unless $self->_load_class("HTML::Object::DOM")
897 0 0 unless $self->_load_class("HTML::Object::DOM::Text")
920 10 54 exists $map->{$type} ? :
960 495 1971 if ($self->isa($class))
984 3 1 if ($kid->nodeType == 3) { }
986 1 2 if ($found) { }
1031 4 1 if defined $parent and $self->_is_a($parent, "HTML::Object::DOM::Element")
1046 0 2 unless $self->_is_a($elem, "HTML::Object::Element")
1052 1 1 unless defined $pos
1059 1 0 if (my $close = $elem->close_tag)
1061 0 1 if (defined($pos = $nodes->pos($close)))
1073 0 1 if scalar @_ < 2
1081 0 1 if (not $parent) { }
0 1 elsif (not $old_parent) { }
0 1 elsif ($old_parent ne $self) { }
0 1 elsif (not $self->_is_a($old_parent, 'HTML::Object::DOM::Document') || $self->_is_a($old_parent, 'HTML::Object::DOM::DocumentFragment') || $self->_is_a($old_parent, 'HTML::Object::DOM::Element')) { }
0 1 elsif (not $self->_is_a($new, 'HTML::Object::DOM::DocumentFragment') || $self->_is_a($new, 'HTML::Object::DOM::Declaration') || $self->_is_a($new, 'HTML::Object::DOM::Element') || $self->_is_a($new, 'HTML::Object::DOM::CharacterData')) { }
0 1 elsif ($self->lineage->has($new)) { }
0 1 elsif ($self->_is_a($new, 'HTML::Object::DOM::Text') || $self->_is_a($new, 'HTML::Object::DOM::Space') and $self->_is_a($new_parent, 'HTML::Object::DOM::Document')) { }
0 1 elsif ($self->isa('HTML::Object::DOM::Declaration') and not $self->_is_a($parent, 'HTML::Object::DOM::Document')) { }
0 1 elsif ($self->_is_a($parent, 'HTML::Object::DOM::Document') and $self->_is_a($new, 'HTML::Object::DOM::DocumentFragment') and $new->childElementCount > 1 || $new->children->grep(sub {
0 1 elsif ($self->_is_a($parent, 'HTML::Object::DOM::Document') and $parent->childElementCount > 0 and $self->_is_a($new, 'HTML::Object::DOM::Element') and not $self->_is_a($old, 'HTML::Object::DOM::Element') && !$self->_is_a($old, 'HTML::Object::DOM::Element::HTML') && $parent->children->grep(sub {
0 1 elsif ($self->_is_a($new, 'HTML::Object::DOM::Element') and $self->_is_a($old->previousSibling, 'HTML::Object::DOM::Declaration')) { }
1184 0 1 if (defined $newPos and not defined $oldPos) { }
0 1 elsif (not defined $oldPos) { }
1199 0 1 $self->_is_a($new, 'HTML::Object::DOM::DocumentFragment') ? :
1202 0 1 unless $self->_is_a($_, "HTML::Object::DOM::Node")
1215 0 7 if $self->isa("HTML::Object::DOM::Document")
1216 0 7 unless ($self->isa("HTML::Object::DOM::Comment") or $self->isa("HTML::Object::DOM::Text") or $self->isa("HTML::Object::DOM::Element"))
1230 0 9 if $self->isa("HTML::Object::DOM::Document")
1232 8 0 if ($self->isa("HTML::Object::DOM::Comment") or $self->isa("HTML::Object::DOM::Text") or $self->isa("HTML::Object::DOM::Element"))
1236 2 7 if ($self->isa('HTML::Object::DOM::Comment') or $self->isa('HTML::Object::DOM::Text')) { }
1258 0 2 unless defined $type and length "$type"
1262 0 2 unless $type =~ /^\w[\w\-]*$/
1275 4 15 unless ($HTML::Object::DOM::Node::XP)
1277 0 4 unless $self->_load_class("HTML::Object::XPath")
1292 0 0 if ($self->_is_a($_, 'HTML::Object::DOM::Node')) { }
0 0 elsif (not ref $_ or ref $_ and overload::Method($_, '""')) { }
1294 0 0 if ($self->_is_a($_, 'HTML::Object::DOM::DocumentFragment')) { }
1314 0 0 if ($self->looks_like_html($_)) { }
1318 0 0 unless $doc->children->is_empty
1323 0 0 if (defined $prev and $self->_is_a($prev, 'HTML::Object::DOM::Text')) { }
1351 0 19 if (ref $this) { }
1357 0 19 unless $self->_load_class("HTML::Selector::XPath")
1359 0 19 if ($INC{'threads.pm'} and not exists $INC{'forks.pm'})
1363 0 0 if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
0 0 &$Nice::Try::TRY ? :
0 0 if scalar @Nice::Try::VOID
0 0 if ($Nice::Try::WANT eq 'OBJECT') { }
0 0 elsif ($Nice::Try::WANT eq 'CODE') { }
0 0 elsif ($Nice::Try::WANT eq 'HASH') { }
0 0 elsif ($Nice::Try::WANT eq 'ARRAY') { }
0 0 elsif ($Nice::Try::WANT eq 'REFSCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'GLOB') { }
0 0 elsif ($Nice::Try::WANT eq 'LIST') { }
0 0 elsif ($Nice::Try::WANT eq 'BOOLEAN') { }
0 0 elsif ($Nice::Try::WANT eq 'VOID') { }
0 0 elsif ($Nice::Try::WANT eq 'SCALAR') { }
0 0 if defined $Nice::Try::LAST_VAL
0 19 if ($Nice::Try::WANTARRAY) { }
19 0 elsif (defined $Nice::Try::WANTARRAY) { }
0 19 if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { }
0 19 length $@ ? :
19 0 unless &Scalar::Util::blessed($@)
0 0 if ($Nice::Try::HAS_CATCH)
0 19 if ($Nice::Try::DIED)
1366 0 0 if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
0 0 &$Nice::Try::CATCH ? :
0 0 if scalar @Nice::Try::VOID
0 0 if ($Nice::Try::WANT eq 'OBJECT') { }
0 0 elsif ($Nice::Try::WANT eq 'CODE') { }
0 0 elsif ($Nice::Try::WANT eq 'HASH') { }
0 0 elsif ($Nice::Try::WANT eq 'ARRAY') { }
0 0 elsif ($Nice::Try::WANT eq 'REFSCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'GLOB') { }
0 0 elsif ($Nice::Try::WANT eq 'LIST') { }
0 0 elsif ($Nice::Try::WANT eq 'BOOLEAN') { }
0 0 elsif ($Nice::Try::WANT eq 'VOID') { }
0 0 elsif ($Nice::Try::WANT eq 'SCALAR') { }
0 0 if ($Nice::Try::WANTARRAY) { }
0 0 elsif (defined $Nice::Try::WANTARRAY) { }
0 0 if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { }
0 0 if $@
0 19 if (defined $Nice::Try::CATCH_DIED)
0 0 if (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__NEXT__') { }
0 0 elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__LAST__') { }
0 0 elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__REDO__') { }
0 0 elsif (defined $Nice::Try::BREAK and $Nice::Try::BREAK eq 'return') { }
0 0 if ($Nice::Try::WANT eq 'LIST') { }
0 0 elsif ($Nice::Try::WANT eq 'VOID') { }
0 0 elsif ($Nice::Try::WANT eq 'OBJECT') { }
0 0 elsif ($Nice::Try::WANT eq 'REFSCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'SCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'BOOLEAN') { }
0 0 elsif ($Nice::Try::WANT eq 'CODE') { }
0 0 elsif ($Nice::Try::WANT eq 'HASH') { }
0 0 elsif ($Nice::Try::WANT eq 'ARRAY') { }
0 0 elsif ($Nice::Try::WANT eq 'GLOB') { }
0 19 $Nice::Try::WANTARRAY ? :
0 19 if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { }
19 0 if (not defined $Nice::Try::BREAK or $Nice::Try::BREAK eq "return")
0 0 scalar @Nice::Try::VOID > 1 ? :
19 0 if (defined $Nice::Try::WANTARRAY || defined $Nice::Try::BREAK && $Nice::Try::BREAK eq 'return' and !&Scalar::Util::blessed($Nice::Try::RETVAL[0]) || &Scalar::Util::blessed($Nice::Try::RETVAL[0]) && !$Nice::Try::RETVAL[0]->isa('Nice::Try::SENTINEL')) { }
0 0 elsif (scalar @Nice::Try::VOID and !&Scalar::Util::blessed($Nice::Try::VOID[0]) || &Scalar::Util::blessed($Nice::Try::VOID[0]) && !$Nice::Try::VOID[0]->isa('Nice::Try::SENTINEL')) { }
0 0 if ($Nice::Try::BREAK eq 'next') { }
0 0 elsif ($Nice::Try::BREAK eq 'last') { }
0 0 elsif ($Nice::Try::BREAK eq 'redo') { }
0 0 if (defined $Nice::Try::BREAK)
0 0 scalar @Nice::Try::LAST_VAL > 1 ? :