| 1 | ##---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | ## HTML Object - ~/lib/HTML/Object/DOM/Document.pm | ||||||||||||||||||||||||||||||||||||||||||||||
| 3 | ## Version v0.3.1 | ||||||||||||||||||||||||||||||||||||||||||||||
| 4 | ## Copyright(c) 2025 DEGUEST Pte. Ltd. | ||||||||||||||||||||||||||||||||||||||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||||||||||||||||||||||||||||||||||||||||||||||
| 6 | ## Created 2021/12/13 | ||||||||||||||||||||||||||||||||||||||||||||||
| 7 | ## Modified 2026/07/04 | ||||||||||||||||||||||||||||||||||||||||||||||
| 8 | ## All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||||||
| 9 | ## | ||||||||||||||||||||||||||||||||||||||||||||||
| 10 | ## | ||||||||||||||||||||||||||||||||||||||||||||||
| 11 | ## This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||||||||||||||||||||
| 12 | ## under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||
| 13 | ##---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||
| 14 | package HTML::Object::DOM::Document; | ||||||||||||||||||||||||||||||||||||||||||||||
| 15 | BEGIN | ||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 35 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 35 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 35 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 35 | warnings::register_categories( 'HTML::Object' ); | |||||||||||||||||||||||||||||||||||||||||||||
| 20 | 35 | ▶ | use parent qw( HTML::Object::Document HTML::Object::DOM::Element ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 35 | ▶ | use vars qw( $VERSION ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 35 | ▶ | use HTML::Object::ErrorEvent; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 35 | ▶ | use Scalar::Util (); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 35 | ▶ | use Wanted; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 35 | our $VERSION = 'v0.3.1'; | |||||||||||||||||||||||||||||||||||||||||||||
| 26 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 35 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 35 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | sub init | ||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 75 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 75 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 34 | 75 | $self->{_init_strict_use_sub} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 35 | 75 | ▶ | $self->HTML::Object::Document::init( @_ ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 75 | $self->{onload} = undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 37 | 75 | $self->{onreadystatechange} = undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 38 | 75 | $self->{visibilitystate} = 'visible'; | |||||||||||||||||||||||||||||||||||||||||||||
| 39 | 75 | $self->{_xpath_eval} = undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 40 | # Nodes are special in the document. In other elements, nodes are the same as children | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | # But here no. There can be only 1 element: html, but one can add a doctype or comments | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | # comments added will be part of the children, but not the doctype. So | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | # $doc->children is always equal to 1, but | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | # $doc->childNodes->length would be equal to 2 (including the doctype) | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | # So our real array is nodes, i.e. what would otherwise be children for other elements | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # $self->{nodes} is automatically created by the read-only method 'nodes' | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # State of the document for document->open(), document->close() | ||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 75 | $self->{_closed} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 49 | 75 | return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 1 | ▶ | sub activeElement : lvalue { return( shift->_set_get_object_lvalue( 'activeelement', 'HTML::Object::DOM::Element', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
activeElement: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||
| 54 | sub adoptNode | ||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
adoptNode: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | my $elem = shift( @_ ) || return( $self->error( "No element object was provided to adopt into our document." ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift @_ || (return $self->error('No element object was provided to adopt into our document.'))
MC/DC0%0/1
shift @_ || (return $self->error('No element object was provided to adopt into our document.'))
shift @_
Truth table0%0/2
A
A= shift @_
| |||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | return( $self->error( "Element provided ($elem) is not a HTML::Object::Element object." ) ) if( !$self->_is_a( $elem, 'HTML::Object::Element' ) || $self->_is_a( $elem, 'HTML::Object::Collection' ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $self->_is_a($elem, "HTML::Object::Element") or $self->_is_a($elem, "HTML::Object::Collection")
MC/DC0%0/2
not $self->_is_a($elem, "HTML::Object::Element") or $self->_is_a($elem, "HTML::Object::Collection")
not $self->_is_a($elem, "HTML::Object::Element")
$self->_is_a($elem, "HTML::Object::Collection")
Truth table0%0/3
not(A) or B
A= not $self->_is_a($elem, "HTML::Object::Element")B= $self->_is_a($elem, "HTML::Object::Collection")
| |||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | if( $elem->parent ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 60 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | $elem->detach; | |||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | return( $elem ); | |||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # Note: method append is different from HTML::Object::DOM::Element because we need to check what goes in | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | sub append | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
append: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | return( $self ) if( !scalar( @_ ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # If a HTML::Object::DOM::DocumentFragment object is provided, its children are | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | # copied to the list and its own children array is emptied. | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | my $list = $self->_check_list_of_nodes_or_text( @_ ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->_check_list_of_nodes_or_text(@_) || (return $self->pass_error)
MC/DC0%0/1
$self->_check_list_of_nodes_or_text(@_) || (return $self->pass_error)
$self->_check_list_of_nodes_or_text(@_)
Truth table0%0/2
A
A= $self->_check_list_of_nodes_or_text(@_)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | my $nodes = $self->nodes; | |||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | $self->reset(1) if( !$list->is_empty ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 76 | $list->foreach(sub | ||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | $_->parent( $self ); | |||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | }); | |||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | $nodes->push( $list->list ); | |||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # Node: method appendChild is inherited | ||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||
| 86 | sub as_string | ||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 7 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 7 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 89 | 7 | my $a = $self->new_array; | |||||||||||||||||||||||||||||||||||||||||||||
| 90 | $self->nodes->foreach(sub | ||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 35 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 35 | my $e = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 93 | 35 | my $v = $e->as_string; | |||||||||||||||||||||||||||||||||||||||||||||
| 94 | 35 | ▶ | $a->push( defined( $v ) ? $v->scalar : $v ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 7 | }); | |||||||||||||||||||||||||||||||||||||||||||||
| 96 | 7 | return( $a->join( '' ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 19 | ▶ | sub body : lvalue { return( shift->_set_get_callback({ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
body: called CC=1 SCAR=2.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 100 | get => sub | ||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 19 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 19 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 103 | 19 | ▶ | my $html = $self->documentElement || | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->documentElement || die('Unable to find a top HTML tag')
MC/DC0%0/1
$self->documentElement || die('Unable to find a top HTML tag')
$self->documentElement
Truth table50%1/2
A
A= $self->documentElement
| |||||||||||||||||||||||||||||||||||||||||||||||
| 104 | die( "Unable to find a top HTML tag" ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 19 | my $children = $html->children; | |||||||||||||||||||||||||||||||||||||||||||||
| 106 | 19 | my $body; | |||||||||||||||||||||||||||||||||||||||||||||
| 107 | 19 | foreach( @$children ) | |||||||||||||||||||||||||||||||||||||||||||||
| 108 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 76 | ▶ | if( $_->tag eq 'body' ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 110 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 19 | $body = $_; | |||||||||||||||||||||||||||||||||||||||||||||
| 112 | # End loop | ||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 19 | last; | |||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 116 | # $body may be undef, and that's ok. A Module::Generic::Null object will be returned instead | ||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 19 | return( $body ); | |||||||||||||||||||||||||||||||||||||||||||||
| 118 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 119 | set => sub | ||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | my $e = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | my $html = $self->documentElement || | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->documentElement || die('Unable to find a top HTML tag')
MC/DC0%0/1
$self->documentElement || die('Unable to find a top HTML tag')
$self->documentElement
Truth table0%0/2
A
A= $self->documentElement
| |||||||||||||||||||||||||||||||||||||||||||||||
| 124 | die( "Unable to find a top HTML tag" ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my $children = $html->children; | |||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | if( !$self->_is_a( $e, 'HTML::Object::Element' ) ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 127 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | die( "Element provided to set as new body element is not a HTML::Object::Element object." ); | |||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | my $body; | |||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | for( my $pos = 0; $pos < scalar( @$children ); $pos++ ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 133 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | my $child = $children->[$pos]; | |||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | if( $child->tag eq 'body' ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 136 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $body = $child; | |||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | $children->offset( $pos, 1, $e ); | |||||||||||||||||||||||||||||||||||||||||||||
| 139 | # End loop | ||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||
| 144 | # No body was found, amazingly enough; add it now | ||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | if( !defined( $body ) ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 146 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | $children->push( $e ); | |||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | return( $e ); | |||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 19 | }, @_ ) ); } | |||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | sub captureEvents { return( shift->defaultView->captureEvents( @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
captureEvents: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 1 | ▶ | sub caretPositionFromPoint { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
caretPositionFromPoint: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | sub caretRangeFromPoint { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
caretRangeFromPoint: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||
| 159 | # read-only | ||||||||||||||||||||||||||||||||||||||||||||||
| 160 | # e.g.: | ||||||||||||||||||||||||||||||||||||||||||||||
| 161 | # <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||||||||||||||||||||||||||||||||||||||||||||||
| 162 | # <meta charset="utf-8" /> | ||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 2 | ▶ | sub characterSet : lvalue | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
characterSet: called CC=11 SCAR=26.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 164 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 2 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 166 | # Get an Module::Generic::Array object | ||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 2 | ▶ | my $results = $self->findNode( 'meta' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->findNode('meta') || (return $self->pass_error)
MC/DC0%0/1
$self->findNode('meta') || (return $self->pass_error)
$self->findNode('meta')
Truth table50%1/2
A
A= $self->findNode('meta')
| |||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 2 | require Module::Generic::HeaderValue; | |||||||||||||||||||||||||||||||||||||||||||||
| 169 | 2 | foreach my $e ( $results->list ) | |||||||||||||||||||||||||||||||||||||||||||||
| 170 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 2 | ▶ | if( $e->attributes->has( 'http-equiv' ) && | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%4/6
$e->attributes->has("http-equiv") and $e->attributes->get("http-equiv") eq "Content-Type" and $e->attributes->has("content")
$e->attributes->has("http-equiv") and $e->attributes->get("http-equiv") eq "Content-Type"
MC/DC33%1/3
$e->attributes->has("http-equiv") and $e->attributes->get("http-equiv") eq "Content-Type" and $e->attributes->has("content")
$e->attributes->has("http-equiv")
$e->attributes->get("http-equiv") eq "Content-Type"
$e->attributes->has("content")
Truth table50%2/4
A and B and C
A= $e->attributes->has("http-equiv")B= $e->attributes->get("http-equiv") eq "Content-Type"C= $e->attributes->has("content")
| |||||||||||||||||||||||||||||||||||||||||||||||
| 172 | $e->attributes->get( 'http-equiv' ) eq 'Content-Type' && | ||||||||||||||||||||||||||||||||||||||||||||||
| 173 | $e->attributes->has( 'content' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 174 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 1 | my $type = $e->attributes->get( 'content' ); | |||||||||||||||||||||||||||||||||||||||||||||
| 176 | 1 | ▶ | next if( !defined( $type ) || !CORE::length( $type ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $type and length $type
MC/DC0%0/2
defined $type and length $type
defined $type
length $type
Truth table33%1/3
A and B
A= defined $typeB= length $type
| |||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 1 | my $hv = Module::Generic::HeaderValue->new_from_header( $type ); | |||||||||||||||||||||||||||||||||||||||||||||
| 178 | 1 | my $charset = $hv->param( 'charset' ); | |||||||||||||||||||||||||||||||||||||||||||||
| 179 | 1 | ▶ | return( $charset // '' ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$charset // ""
MC/DC0%0/1
$charset // ""
$charset
Truth table50%1/2
A
A= $charset
| |||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 181 | elsif( $e->attributes->has( 'charset' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 182 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | ▶ | return( $e->attributes->get( 'charset' ) // '' ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$e->attributes->get("charset") // ""
MC/DC0%0/1
$e->attributes->get("charset") // ""
$e->attributes->get("charset")
Truth table50%1/2
A
A= $e->attributes->get("charset")
| |||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | return( '' ); | |||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||
| 189 | # Note: property childElementCount read-only inherited from HTML::Object::DOM::Element | ||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||
| 191 | # Note: property children read-only | ||||||||||||||||||||||||||||||||||||||||||||||
| 192 | sub children | ||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 430 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
children: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 430 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 195 | 430 | ▶ | if( @_ ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 196 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 5 | return( $self->_set_get_object_array_object( 'children', 'HTML::Object::Element', @_ ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 425 | $self->_init_nodes; | |||||||||||||||||||||||||||||||||||||||||||||
| 200 | 425 | return( $self->_set_get_object_array_object( 'children', 'HTML::Object::Element' ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | sub childNodes : lvalue { return( shift->_set_get_array_as_object( 'nodes', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
childNodes: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||
| 205 | # Note: property children read-only inherited | ||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||
| 207 | sub clone | ||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | my $saved_nodes = $self->{nodes}; | |||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | my $saved_defaultview = $self->{defaultview}; | |||||||||||||||||||||||||||||||||||||||||||||
| 212 | # NOTE: keep the ORIGINAL children list (before SUPER::clone() touches | ||||||||||||||||||||||||||||||||||||||||||||||
| 213 | # anything) so we can map each entry to its already-cloned counterpart | ||||||||||||||||||||||||||||||||||||||||||||||
| 214 | # below, by object identity rather than by tag name. Some fragments | ||||||||||||||||||||||||||||||||||||||||||||||
| 215 | # (like this invoice template, which starts directly at <body> with no | ||||||||||||||||||||||||||||||||||||||||||||||
| 216 | # <html> wrapper) never trigger the 'html' narrowing in _init_nodes(), | ||||||||||||||||||||||||||||||||||||||||||||||
| 217 | # so 'children' ends up being the SAME full set as 'nodes' — not a | ||||||||||||||||||||||||||||||||||||||||||||||
| 218 | # single-element subset as the previous version assumed. | ||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | my $orig_children = $self->{children}; | |||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | local $self->{nodes} = undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | local $self->{defaultview} = undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | my $new = $self->SUPER::clone(); | |||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||
| 224 | # NOTE: temporary diagnostic — inventaire de tous les champs de $self, | ||||||||||||||||||||||||||||||||||||||||||||||
| 225 | # triés par taille décroissante, pour identifier le(s) champ(s) responsable(s) | ||||||||||||||||||||||||||||||||||||||||||||||
| 226 | # du surcoût restant, plutôt que de continuer à deviner des noms un par un. | ||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | foreach my $k ( sort { total_size( $self->{ $b } ) <=> total_size( $self->{ $a } ) } CORE::keys( %$self ) ) | |||||||||||||||||||||||||||||||||||||||||||||
| 228 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | next unless( ref( $self->{ $k } ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||
| 232 | # NOTE: defaultView/window represents the execution context, not document | ||||||||||||||||||||||||||||||||||||||||||||||
| 233 | # content — the clone reuses the SAME Window instance as the original | ||||||||||||||||||||||||||||||||||||||||||||||
| 234 | # rather than cloning it. No identity-mapping needed here (unlike | ||||||||||||||||||||||||||||||||||||||||||||||
| 235 | # 'nodes'/'children' above), since there's exactly one window, not a list. | ||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | $new->{defaultview} = $saved_defaultview if( defined( $saved_defaultview ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | if( defined( $saved_nodes ) && $self->_is_a( $saved_nodes => 'Module::Generic::Array' ) ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $saved_nodes and $self->_is_a($saved_nodes, "Module::Generic::Array")
MC/DC0%0/2
defined $saved_nodes and $self->_is_a($saved_nodes, "Module::Generic::Array")
defined $saved_nodes
$self->_is_a($saved_nodes, "Module::Generic::Array")
Truth table0%0/3
A and B
A= defined $saved_nodesB= $self->_is_a($saved_nodes, "Module::Generic::Array")
| |||||||||||||||||||||||||||||||||||||||||||||||
| 239 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 240 | # NOTE: Build a map from original child object address to its | ||||||||||||||||||||||||||||||||||||||||||||||
| 241 | # already-cloned counterpart. clone_list(), inside SUPER::clone(), | ||||||||||||||||||||||||||||||||||||||||||||||
| 242 | # clones each entry of 'children' in order, so zipping the original | ||||||||||||||||||||||||||||||||||||||||||||||
| 243 | # and new lists by index gives us that correspondence cheaply. | ||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | my %clone_of; | |||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | if( $self->_is_a( $orig_children => 'Module::Generic::Array' ) && $new->children ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->_is_a($orig_children, "Module::Generic::Array") and $new->children
MC/DC0%0/2
$self->_is_a($orig_children, "Module::Generic::Array") and $new->children
$self->_is_a($orig_children, "Module::Generic::Array")
$new->children
Truth table0%0/3
A and B
A= $self->_is_a($orig_children, "Module::Generic::Array")B= $new->children
| |||||||||||||||||||||||||||||||||||||||||||||||
| 246 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 247 | # $orig_children->list returns an array, not an array reference. | ||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | my $orig_list = $orig_children; | |||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | my $new_list = $new->children; | |||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | for( my $i = 0; $i < scalar( @$orig_list ); $i++ ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 251 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ▶ | next unless( ref( $orig_list->[ $i ] ) && ref( $new_list->[ $i ] ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $orig_list->[$i] and ref $new_list->[$i]
MC/DC0%0/2
ref $orig_list->[$i] and ref $new_list->[$i]
ref $orig_list->[$i]
ref $new_list->[$i]
Truth table0%0/3
A and B
A= ref $orig_list->[$i]B= ref $new_list->[$i]
| |||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | $clone_of{ Scalar::Util::refaddr( $orig_list->[ $i ] ) } = $new_list->[ $i ]; | |||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||
| 257 | my $cloned_nodes = $saved_nodes->map(sub | ||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | my $n = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | my $addr = Scalar::Util::refaddr( $n ); | |||||||||||||||||||||||||||||||||||||||||||||
| 261 | # NOTE: already cloned via 'children' — reuse it, do not clone again. | ||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | return( $clone_of{ $addr } ) if( exists( $clone_of{ $addr } ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 263 | # Not part of 'children' (e.g. a leading DOCTYPE excluded by | ||||||||||||||||||||||||||||||||||||||||||||||
| 264 | # design) — clone_list() never touched it, clone independently. | ||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | my $c = $n->clone; | |||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | $c->parent( $new ); | |||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | return( $c ); | |||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | }); | |||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | $new->{nodes} = $cloned_nodes; | |||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | $self->{nodes} = $saved_nodes; | |||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | $self->{defaultview} = $saved_defaultview; | |||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | return( $new ); | |||||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||
| 277 | # method cloneNode is inherited from HTML::Object::DOM::Node | ||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | ▶ | sub close { return( shift->{_closed} = 1 ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
close: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 1 | ▶ | sub compatMode : lvalue { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compatMode: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||
| 283 | # read-only | ||||||||||||||||||||||||||||||||||||||||||||||
| 284 | # e.g.: | ||||||||||||||||||||||||||||||||||||||||||||||
| 285 | # <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||||||||||||||||||||||||||||||||||||||||||||||
| 286 | sub contentType | ||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
contentType: called CC=9 SCAR=23.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 2 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 289 | 2 | ▶ | my $results = $self->findNode( 'meta' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->findNode('meta') || (return $self->pass_error)
MC/DC0%0/1
$self->findNode('meta') || (return $self->pass_error)
$self->findNode('meta')
Truth table50%1/2
A
A= $self->findNode('meta')
| |||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 2 | require Module::Generic::HeaderValue; | |||||||||||||||||||||||||||||||||||||||||||||
| 291 | 2 | my $default = 'text/html'; | |||||||||||||||||||||||||||||||||||||||||||||
| 292 | 2 | foreach my $e ( $results->list ) | |||||||||||||||||||||||||||||||||||||||||||||
| 293 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 2 | ▶ | if( $e->attributes->has( 'http-equiv' ) && | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$e->attributes->has("http-equiv") and $e->attributes->get("http-equiv") eq "Content-Type" and $e->attributes->has("content")
$e->attributes->has("http-equiv") and $e->attributes->get("http-equiv") eq "Content-Type"
MC/DC33%1/3
$e->attributes->has("http-equiv") and $e->attributes->get("http-equiv") eq "Content-Type" and $e->attributes->has("content")
$e->attributes->has("http-equiv")
$e->attributes->get("http-equiv") eq "Content-Type"
$e->attributes->has("content")
Truth table50%2/4
A and B and C
A= $e->attributes->has("http-equiv")B= $e->attributes->get("http-equiv") eq "Content-Type"C= $e->attributes->has("content")
| |||||||||||||||||||||||||||||||||||||||||||||||
| 295 | $e->attributes->get( 'http-equiv' ) eq 'Content-Type' && | ||||||||||||||||||||||||||||||||||||||||||||||
| 296 | $e->attributes->has( 'content' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 297 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 1 | my $type = $e->attributes->get( 'content' ); | |||||||||||||||||||||||||||||||||||||||||||||
| 299 | 1 | ▶ | next if( !defined( $type ) || !CORE::length( $type ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $type and length $type
MC/DC0%0/2
defined $type and length $type
defined $type
length $type
Truth table33%1/3
A and B
A= defined $typeB= length $type
| |||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 1 | my $hv = Module::Generic::HeaderValue->new_from_header( $type ); | |||||||||||||||||||||||||||||||||||||||||||||
| 301 | 1 | ▶ | return( $hv->value->first // $default ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$hv->value->first // $default
MC/DC0%0/2
$hv->value->first // $default
$hv->value->first
$default
Truth table33%1/3
A // B
A= $hv->value->firstB= $default
| |||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 1 | return( $default ); | |||||||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 2 | ▶ | sub cookie : lvalue { return( shift->_set_get_lvalue( '_cookie', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cookie: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||
| 309 | sub createAttribute | ||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createAttribute: called CC=4 SCAR=14.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 1 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 312 | 1 | my $name = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 313 | 1 | ▶ | $name = lc( $name ) if( defined( $name ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 1 | ▶ | return( $self->error({ | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 315 | message => "The attribute provided \"$name\" contains illegal characters.", | ||||||||||||||||||||||||||||||||||||||||||||||
| 316 | class => 'HTML::Object::SyntaxError', | ||||||||||||||||||||||||||||||||||||||||||||||
| 317 | }) ) if( !$self->is_valid_attribute( $name ) ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 1 | require HTML::Object::DOM::Attribute; | |||||||||||||||||||||||||||||||||||||||||||||
| 319 | 1 | ▶ | my $att = HTML::Object::DOM::Attribute->new( $name, @_ ) || | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
'HTML::Object::DOM::Attribute'->new($name, @_) || (return $self->pass_error('HTML::Object::DOM::Attribute'->error))
MC/DC0%0/1
'HTML::Object::DOM::Attribute'->new($name, @_) || (return $self->pass_error('HTML::Object::DOM::Attribute'->error))
'HTML::Object::DOM::Attribute'->new($name, @_)
Truth table50%1/2
A
A= 'HTML::Object::DOM::Attribute'->new($name, @_)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 320 | return( $self->pass_error( HTML::Object::DOM::Attribute->error ) ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 1 | return( $att ); | |||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | ▶ | sub createAttributeNS { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createAttributeNS: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | ▶ | sub createCDATASection { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createCDATASection: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||
| 328 | # TODO Create pod: https://developer.mozilla.org/en-US/docs/Web/API/Document/createComment | ||||||||||||||||||||||||||||||||||||||||||||||
| 329 | sub createComment | ||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createComment: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | my $data; | |||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | $data = join( '', @_ ) if( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | return( $self->new_comment( value => $data ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||
| 337 | sub createDocumentFragment | ||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createDocumentFragment: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 1 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 340 | 1 | require HTML::Object::DOM::DocumentFragment; | |||||||||||||||||||||||||||||||||||||||||||||
| 341 | 1 | ▶ | my $frag = HTML::Object::DOM::DocumentFragment->new( @_ ) || | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
'HTML::Object::DOM::DocumentFragment'->new(@_) || (return $self->pass_error('HTML::Object::DOM::DocumentFragment'->error))
MC/DC0%0/1
'HTML::Object::DOM::DocumentFragment'->new(@_) || (return $self->pass_error('HTML::Object::DOM::DocumentFragment'->error))
'HTML::Object::DOM::DocumentFragment'->new(@_)
Truth table50%1/2
A
A= 'HTML::Object::DOM::DocumentFragment'->new(@_)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 342 | return( $self->pass_error( HTML::Object::DOM::DocumentFragment->error ) ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 1 | return( $frag ); | |||||||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||
| 346 | sub createElement | ||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 15 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createElement: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 15 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 349 | 15 | ▶ | my $tag = shift( @_ ) || return( $self->error( "No tag was provided to create an element." ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift @_ || (return $self->error('No tag was provided to create an element.'))
MC/DC0%0/1
shift @_ || (return $self->error('No tag was provided to create an element.'))
shift @_
Truth table50%1/2
A
A= shift @_
| |||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 15 | my $opts = $self->_get_args_as_hash( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 351 | 15 | my $p = HTML::Object::DOM->new; | |||||||||||||||||||||||||||||||||||||||||||||
| 352 | 15 | my $def = $p->get_definition( $tag ); | |||||||||||||||||||||||||||||||||||||||||||||
| 353 | # Even if the tag does not exist, the default behaviour is to accept whatever was | ||||||||||||||||||||||||||||||||||||||||||||||
| 354 | # provided and assume it is a non-empty tag | ||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 15 | ▶ | if( !defined( $def ) ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 356 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | $def = | |||||||||||||||||||||||||||||||||||||||||||||
| 358 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 359 | is_empty => 0, | ||||||||||||||||||||||||||||||||||||||||||||||
| 360 | is_inline => 0, | ||||||||||||||||||||||||||||||||||||||||||||||
| 361 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 15 | $opts->{debug} = $self->debug; | |||||||||||||||||||||||||||||||||||||||||||||
| 365 | 15 | @$opts{qw( is_empty is_inline )} = @$def{qw( is_empty is_inline )}; | |||||||||||||||||||||||||||||||||||||||||||||
| 366 | 15 | $opts->{tag} = $tag; | |||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 15 | my $e; | |||||||||||||||||||||||||||||||||||||||||||||
| 369 | 15 | ▶ | $def->{class} //= ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$def->{"class"} //= ""
MC/DC100%1/1
$def->{"class"} //= ""
$def->{"class"}
Truth table100%2/2
A
A= $def->{"class"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 15 | ▶ | if( $def->{class} ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 371 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 14 | $e = $p->new_special( $def->{class} => $opts ); | |||||||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 374 | else | ||||||||||||||||||||||||||||||||||||||||||||||
| 375 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 1 | $e = $p->new_element( $opts ); | |||||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 15 | $e->close; | |||||||||||||||||||||||||||||||||||||||||||||
| 379 | 15 | return( $e ); | |||||||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | sub createElementNS { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createElementNS: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||
| 384 | # TODO: createEntityReference | ||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | ▶ | sub createEntityReference { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createEntityReference: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||
| 387 | # TODO createEvent https://developer.mozilla.org/en-US/docs/Web/API/Document/createEvent | ||||||||||||||||||||||||||||||||||||||||||||||
| 388 | sub createEvent | ||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createEvent: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | ▶ | my $type = shift( @_ ) || return( $self->error({ | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift @_ || (return $self->error({'message', 'No event type was provided', 'class', 'HTML::Objct::SyntaxError'}))
MC/DC0%0/1
shift @_ || (return $self->error({'message', 'No event type was provided', 'class', 'HTML::Objct::SyntaxError'}))
shift @_
Truth table0%0/2
A
A= shift @_
| |||||||||||||||||||||||||||||||||||||||||||||||
| 392 | message => 'No event type was provided', | ||||||||||||||||||||||||||||||||||||||||||||||
| 393 | class => 'HTML::Objct::SyntaxError', | ||||||||||||||||||||||||||||||||||||||||||||||
| 394 | }) ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | $self->_load_class( 'HTML::Object::Event' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | my $evt = HTML::Object::Event->new( $type, @_ ) || | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
'HTML::Object::Event'->new($type, @_) || (return $self->pass_error('HTML::Object::Event'->error))
MC/DC0%0/1
'HTML::Object::Event'->new($type, @_) || (return $self->pass_error('HTML::Object::Event'->error))
'HTML::Object::Event'->new($type, @_)
Truth table0%0/2
A
A= 'HTML::Object::Event'->new($type, @_)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 397 | return( $self->pass_error( HTML::Object::Event->error ) ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | return( $evt ); | |||||||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||
| 401 | # TODO: createExpression | ||||||||||||||||||||||||||||||||||||||||||||||
| 402 | sub createExpression | ||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createExpression: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | my $eval; | |||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | ▶ | unless( $eval = $self->{_xpath_eval} ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 407 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | ▶ | $self->_load_class( 'HTML::Object::DOM::XPathEvaluator' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | ▶ | $self->{_xpath_eval} = $eval = HTML::Object::DOM::XPathEvaluator->new || | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
'HTML::Object::DOM::XPathEvaluator'->new || (return $self->pass_error('HTML::Object::DOM::XPathEvaluator'->error))
MC/DC0%0/1
'HTML::Object::DOM::XPathEvaluator'->new || (return $self->pass_error('HTML::Object::DOM::XPathEvaluator'->error))
'HTML::Object::DOM::XPathEvaluator'->new
Truth table0%0/2
A
A= 'HTML::Object::DOM::XPathEvaluator'->new
| |||||||||||||||||||||||||||||||||||||||||||||||
| 410 | return( $self->pass_error( HTML::Object::DOM::XPathEvaluator->error ) ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | my $expr = $eval->createExpression( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | ▶ | return( $self->pass_error( $eval->error ) ) if( !defined( $expr ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | return( $expr ); | |||||||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||
| 417 | # TODO: createNSResolver | ||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | ▶ | sub createNSResolver { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createNSResolver: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||
| 420 | # TODO: createNodeIterator | ||||||||||||||||||||||||||||||||||||||||||||||
| 421 | sub createNodeIterator | ||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createNodeIterator: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 2 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 424 | 2 | ▶ | $self->_load_class( 'HTML::Object::DOM::NodeIterator' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 2 | my $iterator = HTML::Object::DOM::NodeIterator->new( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 426 | 2 | ▶ | return( $self->pass_error( HTML::Object::DOM::NodeIterator->error ) ) if( !defined( $iterator ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 2 | return( $iterator ); | |||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | ▶ | sub createProcessingInstruction { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createProcessingInstruction: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||
| 432 | # TODO: createRange | ||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | sub createRange { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createRange: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||||||
| 435 | sub createTextNode | ||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createTextNode: called CC=4 SCAR=14.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 1 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 438 | 1 | ▶ | my $txt = @_ == 1 ? shift( @_ ) : join( '', @_ ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 1 | ▶ | $self->_load_class( 'HTML::Object::DOM::Text' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 1 | ▶ | my $node = HTML::Object::DOM::Text->new( value => $txt ) || | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
'HTML::Object::DOM::Text'->new('value', $txt) || (return $self->pass_error('HTML::Object::DOM::Text'->error))
MC/DC0%0/1
'HTML::Object::DOM::Text'->new('value', $txt) || (return $self->pass_error('HTML::Object::DOM::Text'->error))
'HTML::Object::DOM::Text'->new('value', $txt)
Truth table50%1/2
A
A= 'HTML::Object::DOM::Text'->new('value', $txt)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 441 | return( $self->pass_error( HTML::Object::DOM::Text->error ) ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 1 | return( $node ); | |||||||||||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | ▶ | sub createTouch { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createTouch: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | ▶ | sub createTouchList { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createTouchList: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||||||
| 449 | sub createTreeWalker | ||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createTreeWalker: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 8 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 452 | 8 | ▶ | $self->_load_class( 'HTML::Object::DOM::TreeWalker' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 8 | my $crawler = HTML::Object::DOM::TreeWalker->new( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 454 | 8 | ▶ | return( $self->pass_error( HTML::Object::DOM::TreeWalker->error ) ) if( !defined( $crawler ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 8 | return( $crawler ); | |||||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | ▶ | sub currentScript { return( shift->_set_get_object_lvalue( 'currentscript', 'HTML::Object::DOM::Element', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
currentScript: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 71 | ▶ | sub defaultView : lvalue { return( shift->_set_get_object_lvalue( 'defaultview', 'HTML::Object::DOM::Window', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
defaultView: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 1 | ▶ | sub designMode : lvalue { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
designMode: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 2 | ▶ | sub dir : lvalue { return( shift->_set_get_lvalue( '_dir' ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dir: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||
| 466 | # Note: property doctype read-only | ||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 3 | ▶ | sub doctype : lvalue | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
doctype: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 468 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 3 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 470 | 3 | return( $self->declaration ); | |||||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||
| 473 | # Note: property documentElement read-only | ||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 23 | ▶ | sub documentElement : lvalue | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
documentElement: called CC=7 SCAR=22.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 475 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 23 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 477 | 23 | ▶ | if( @_ ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 478 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | ▶ | warn( "This property \"documentElement\" is read-only.\n" ) if( $self->_is_warnings_enabled( 'HTML::Object' ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 23 | my $html; | |||||||||||||||||||||||||||||||||||||||||||||
| 482 | # It should be the first one, but let's not assume anything | ||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 23 | my $children = $self->children; | |||||||||||||||||||||||||||||||||||||||||||||
| 484 | 23 | foreach( @$children ) | |||||||||||||||||||||||||||||||||||||||||||||
| 485 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 69 | ▶ | if( $_->tag eq 'html' ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 487 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 23 | $html = $_; | |||||||||||||||||||||||||||||||||||||||||||||
| 489 | 23 | last; | |||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 23 | ▶ | if( !$html && want( 'OBJECT' ) ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $html and want("OBJECT")
MC/DC0%0/2
not $html and want("OBJECT")
not $html
want("OBJECT")
Truth table33%1/3
not(A) and B
A= not $htmlB= want("OBJECT")
| |||||||||||||||||||||||||||||||||||||||||||||||
| 493 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | require Module::Generic::Null; | |||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | return( Module::Generic::Null->new( wants => 'OBJECT' ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 23 | return( $html ); | |||||||||||||||||||||||||||||||||||||||||||||
| 498 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||||||
| 500 | # Note: property documentURI read-only | ||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 1 | ▶ | sub documentURI : lvalue { return( shift->_set_get_uri( 'uri', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
documentURI: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | ▶ | sub elementFromPoint { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
elementFromPoint: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | ▶ | sub elementsFromPoint { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
elementsFromPoint: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||||||
| 507 | # Note: property read-only embeds | ||||||||||||||||||||||||||||||||||||||||||||||
| 508 | sub embeds | ||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
embeds: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 1 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 511 | 1 | ▶ | my $results = $self->findNode( 'embed' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->findNode('embed') || (return $self->pass_error)
MC/DC0%0/1
$self->findNode('embed') || (return $self->pass_error)
$self->findNode('embed')
Truth table50%1/2
A
A= $self->findNode('embed')
| |||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 1 | return( $self->new_collection_elements( $results ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | ▶ | sub enableStyleSheetsForSet { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enableStyleSheetsForSet: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||
| 517 | sub evaluate | ||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
evaluate: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | my $eval; | |||||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | ▶ | unless( $eval = $self->{_xpath_eval} ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 522 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | ▶ | $self->_load_class( 'HTML::Object::DOM::XPathEvaluator' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | ▶ | $self->{_xpath_eval} = $eval = HTML::Object::DOM::XPathEvaluator->new || | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
'HTML::Object::DOM::XPathEvaluator'->new || (return $self->pass_error('HTML::Object::DOM::XPathEvaluator'->error))
MC/DC0%0/1
'HTML::Object::DOM::XPathEvaluator'->new || (return $self->pass_error('HTML::Object::DOM::XPathEvaluator'->error))
'HTML::Object::DOM::XPathEvaluator'->new
Truth table0%0/2
A
A= 'HTML::Object::DOM::XPathEvaluator'->new
| |||||||||||||||||||||||||||||||||||||||||||||||
| 525 | return( $self->pass_error( HTML::Object::DOM::XPathEvaluator->error ) ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | return( $eval->evaluate( @_ ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | ▶ | sub execCommand { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execCommand: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | ▶ | sub exitPictureInPicture { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exitPictureInPicture: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | sub exitPointerLock { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exitPointerLock: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 1 | ▶ | sub featurePolicy : lvalue { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
featurePolicy: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||||||
| 538 | # Note: firstChild returns its values from the nodes array, not the children one; is inherited | ||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||
| 540 | # Note: method firstElementChild is inherited from HTML::Object::DOM::Element | ||||||||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||||||
| 542 | # Note: property read-only fonts | ||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 1 | ▶ | sub fonts { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fonts: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||||||
| 545 | # Note: property read-only forms | ||||||||||||||||||||||||||||||||||||||||||||||
| 546 | sub forms | ||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
forms: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 1 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 549 | 1 | ▶ | my $results = $self->findNode( 'form' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->findNode('form') || (return $self->pass_error)
MC/DC0%0/1
$self->findNode('form') || (return $self->pass_error)
$self->findNode('form')
Truth table50%1/2
A
A= $self->findNode('form')
| |||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 1 | return( $self->new_collection_elements( $results ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 1 | ▶ | sub fullscreenElement : lvalue { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fullscreenElement: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | ▶ | sub getAnimations { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getAnimations: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | ▶ | sub getBoxQuads { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getBoxQuads: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||||||
| 559 | sub getElementById | ||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 20 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getElementById: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 20 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 562 | 20 | my $id = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 563 | 20 | ▶ | return if( !defined( $id ) || !CORE::length( $id ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $id and length $id
MC/DC0%0/2
defined $id and length $id
defined $id
length $id
Truth table33%1/3
A and B
A= defined $idB= length $id
| |||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 20 | my $seen = {}; | |||||||||||||||||||||||||||||||||||||||||||||
| 565 | 20 | my $crawl; | |||||||||||||||||||||||||||||||||||||||||||||
| 566 | $crawl = sub | ||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 384 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 384 | my $elem = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 569 | 384 | my $addr = Scalar::Util::refaddr( $elem ); | |||||||||||||||||||||||||||||||||||||||||||||
| 570 | 384 | ▶ | return if( CORE::exists( $seen->{ $addr } ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 571 | # Not a true element, such as text, comment | ||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 384 | ▶ | return if( $elem->tag->substr( 0, 1 ) eq '_' && !$self->_is_a( $elem => 'HTML::Object::Document' ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$elem->tag->substr(0, 1) eq "_" and not $self->_is_a($elem, "HTML::Object::Document")
MC/DC100%2/2
$elem->tag->substr(0, 1) eq "_" and not $self->_is_a($elem, "HTML::Object::Document")
$elem->tag->substr(0, 1) eq "_"
not $self->_is_a($elem, "HTML::Object::Document")
Truth table100%3/3
A and not(B)
A= $elem->tag->substr(0, 1) eq "_"B= not $self->_is_a($elem, "HTML::Object::Document")
| |||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 179 | $seen->{ $addr }++; | |||||||||||||||||||||||||||||||||||||||||||||
| 574 | 179 | ▶ | if( $elem->attributes->has( 'id' ) && | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$elem->attributes->has("id") and $elem->attributes->get("id") eq $id
MC/DC100%2/2
$elem->attributes->has("id") and $elem->attributes->get("id") eq $id
$elem->attributes->has("id")
$elem->attributes->get("id") eq $id
Truth table100%3/3
A and B
A= $elem->attributes->has("id")B= $elem->attributes->get("id") eq $id
| |||||||||||||||||||||||||||||||||||||||||||||||
| 575 | $elem->attributes->get( 'id' ) eq $id ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 576 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 20 | return( $elem ); | |||||||||||||||||||||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 159 | my $e; | |||||||||||||||||||||||||||||||||||||||||||||
| 580 | $elem->children->foreach(sub | ||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 364 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 364 | my $this = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 583 | 364 | ▶ | if( my $found = $crawl->( $this ) ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 584 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 60 | $e = $found; | |||||||||||||||||||||||||||||||||||||||||||||
| 586 | # last | ||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 60 | return(0); | |||||||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 304 | return(1); | |||||||||||||||||||||||||||||||||||||||||||||
| 590 | 159 | }); | |||||||||||||||||||||||||||||||||||||||||||||
| 591 | 159 | return( $e ); | |||||||||||||||||||||||||||||||||||||||||||||
| 592 | 20 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 593 | 20 | return( $crawl->( $self ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||||||
| 596 | # Note: method getElementsByClassName is inherited from HTML::Object::DOM::Element | ||||||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||||||
| 598 | sub getElementsByName | ||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getElementsByName: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | my $name = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | ▶ | return( $self->error( "No value was provided for getElementsByName()" ) ) if( !defined( $name ) || !CORE::length( "$name" ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $name and length "$name"
MC/DC0%0/2
defined $name and length "$name"
defined $name
length "$name"
Truth table0%0/3
A and B
A= defined $nameB= length "$name"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | ▶ | my $results = $self->look_down( name => $name ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->look_down('name', $name) || (return $self->pass_error)
MC/DC0%0/1
$self->look_down('name', $name) || (return $self->pass_error)
$self->look_down('name', $name)
Truth table0%0/2
A
A= $self->look_down('name', $name)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | ▶ | my $list = $self->new_nodelist( $results ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->new_nodelist($results) || (return $self->pass_error)
MC/DC0%0/1
$self->new_nodelist($results) || (return $self->pass_error)
$self->new_nodelist($results)
Truth table0%0/2
A
A= $self->new_nodelist($results)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | return( $list ); | |||||||||||||||||||||||||||||||||||||||||||||
| 606 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||||||
| 608 | # Note: method getElementsByTagName is inherited from HTML::Object::DOM::Element | ||||||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | ▶ | sub getElementsByTagNameNS { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getElementsByTagNameNS: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 20 | ▶ | sub getRootNode { return( shift->root ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getRootNode: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | ▶ | sub getSelection { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getSelection: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||||||
| 616 | # Note: method hasChildNodes is inherited | ||||||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | ▶ | sub hasFocus { return(1); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hasFocus: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | ▶ | sub hasStorageAccess { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hasStorageAccess: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||||||
| 622 | # Note: property head read-only | ||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 3 | ▶ | sub head : lvalue | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
head: called CC=4 SCAR=16.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 624 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 3 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 626 | 3 | ▶ | my $results = $self->findNode( 'head' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->findNode('head') || (return $self->pass_error)
MC/DC0%0/1
$self->findNode('head') || (return $self->pass_error)
$self->findNode('head')
Truth table50%1/2
A
A= $self->findNode('head')
| |||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 3 | my $head = $results->first; | |||||||||||||||||||||||||||||||||||||||||||||
| 628 | 3 | ▶ | if( !$head && want( 'OBJECT' ) ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $head and want("OBJECT")
MC/DC0%0/2
not $head and want("OBJECT")
not $head
want("OBJECT")
Truth table33%1/3
not(A) and B
A= not $headB= want("OBJECT")
| |||||||||||||||||||||||||||||||||||||||||||||||
| 629 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | require Module::Generic::Null; | |||||||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | rreturn( Module::Generic::Null->new( wants => 'OBJECT' ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 632 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 3 | return( $head ); | |||||||||||||||||||||||||||||||||||||||||||||
| 634 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||||||
| 636 | # Note: property hidden read-only | ||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 1 | ▶ | sub hidden : lvalue { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hidden: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||||||
| 639 | # Note: property images read-only | ||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 1 | ▶ | sub images : lvalue | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
images: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 641 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 1 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 643 | 1 | ▶ | my $results = $self->findNode( 'img' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->findNode('img') || (return $self->pass_error)
MC/DC0%0/1
$self->findNode('img') || (return $self->pass_error)
$self->findNode('img')
Truth table50%1/2
A
A= $self->findNode('img')
| |||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 1 | return( $self->new_collection_elements( $results ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 645 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||||||
| 647 | # Note: property implementation read-only | ||||||||||||||||||||||||||||||||||||||||||||||
| 648 | sub implementation | ||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
implementation: called CC=4 SCAR=14.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 1 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 651 | 1 | ▶ | unless( $self->{_implementation} ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 652 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 1 | ▶ | $self->_load_class( 'HTML::Object::DOM::Implementation' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 1 | ▶ | $self->{_implementation} = HTML::Object::DOM::Implementation->new( debug => $self->debug ) || | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
'HTML::Object::DOM::Implementation'->new('debug', $self->debug) || (return $self->pass_error('HTML::Object::DOM::Implementation'->error))
MC/DC0%0/1
'HTML::Object::DOM::Implementation'->new('debug', $self->debug) || (return $self->pass_error('HTML::Object::DOM::Implementation'->error))
'HTML::Object::DOM::Implementation'->new('debug', $self->debug)
Truth table50%1/2
A
A= 'HTML::Object::DOM::Implementation'->new('debug', $self->debug)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 655 | return( $self->pass_error( HTML::Object::DOM::Implementation->error ) ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 1 | return( $self->{_implementation} ); | |||||||||||||||||||||||||||||||||||||||||||||
| 658 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | ▶ | sub importNode { return( shift->adoptNode( @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
importNode: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||||||
| 662 | # Note: method insertAfter is inherited | ||||||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||||||
| 664 | # Note: method insertBefore is inherited | ||||||||||||||||||||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||||||||||||||||||||
| 666 | # Note: property lastChild is inherited | ||||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||||
| 668 | # Note: method lastElementChild is inherited from HTML::Object::DOM::Element | ||||||||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 1 | ▶ | sub lastModified : lvalue { return( shift->_set_get_datetime( '_last_modified' ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lastModified: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||||||
| 672 | # Note: property links read-only | ||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 1 | ▶ | sub links : lvalue | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
links: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 674 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 1 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 676 | 1 | ▶ | my $results = $self->findNode( 'a' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->findNode('a') || (return $self->pass_error)
MC/DC0%0/1
$self->findNode('a') || (return $self->pass_error)
$self->findNode('a')
Truth table50%1/2
A
A= $self->findNode('a')
| |||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 1 | return( $results ); | |||||||||||||||||||||||||||||||||||||||||||||
| 678 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 1 | ▶ | sub location : lvalue { return( shift->_set_get_uri( 'uri', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
location: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | ▶ | sub mozSetImageElement { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mozSetImageElement: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||||||||||||||||
| 684 | # Note: property mozSyntheticDocument | ||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | ▶ | sub mozSyntheticDocument : lvalue { return( shift->_set_get_boolean( 'mozsyntheticdocument', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mozSyntheticDocument: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | ▶ | sub nextSibling { return( shift->new_null ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nextSibling: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||||||
| 689 | # See also children for its alter ego | ||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 42 | ▶ | sub nodes { return( shift->_init_nodes ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nodes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||||||
| 692 | # Note: Property | ||||||||||||||||||||||||||||||||||||||||||||||
| 693 | # Should be undef for document | ||||||||||||||||||||||||||||||||||||||||||||||
| 694 | # <https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue> | ||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 2 | ▶ | sub nodeValue { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nodeValue: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||||||
| 697 | # Note: this is merely an alias to HTML::Object::DOM::Node->normalize | ||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | ▶ | sub normalizeDocument { return( shift->normalize( @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
normalizeDocument: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||||||
| 700 | # Note: Property | ||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | ▶ | sub onabort : lvalue { return( shift->_set_get_on_signal( [qw( ABRT TERM INT )], @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
onabort: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | ▶ | sub onafterscriptexecute : lvalue { return( shift->on( 'afterscriptexecute', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
onafterscriptexecute: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 0 | ▶ | sub onbeforescriptexecute : lvalue { return( shift->on( 'beforescriptexecute', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
onbeforescriptexecute: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | ▶ | sub oncopy : lvalue { return( shift->on( 'copy', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oncopy: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | ▶ | sub oncut : lvalue { return( shift->on( 'cut', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oncut: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | ▶ | sub onerror : lvalue { return( shift->_set_get_on_signal( [qw( __WARN__ )], @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
onerror: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | ▶ | sub onfullscreenchange : lvalue { return( shift->on( 'fullscreenchange', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
onfullscreenchange: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | ▶ | sub onfullscreenerror : lvalue { return( shift->on( 'fullscreenerror', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
onfullscreenerror: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 68 | ▶ | sub onload : lvalue { return( shift->_set_get_code( 'onload', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
onload: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | ▶ | sub onpaste : lvalue { return( shift->on( 'paste', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
onpaste: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||||||||||||||||
| 721 | # sub onreadystatechange : lvalue { return( shift->_set_get_code( 'onreadystatechange', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 196 | ▶ | sub onreadystatechange : lvalue { return( shift->on( 'readystatechange', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
onreadystatechange: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | ▶ | sub onscroll : lvalue { return( shift->on( 'scroll', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
onscroll: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 0 | ▶ | sub onselectionchange : lvalue { return( shift->on( 'selectionchange', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
onselectionchange: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 0 | ▶ | sub onvisibilitychange : lvalue { return( shift->on( 'visibilitychange', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
onvisibilitychange: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 0 | ▶ | sub onwheel : lvalue { return( shift->on( 'wheel', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
onwheel: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||||||||||||||||||||
| 732 | sub open | ||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
open: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 735 | # Already opened | ||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | ▶ | return( $self ) if( !$self->{_closed} ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | ▶ | my $doc = $self->_list_to_nodes( q{<html><head><title></title></head><body></body></html>} ) || | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->_list_to_nodes('<html><head><title></title></head><body></body></html>') || (return $self->pass_error)
MC/DC0%0/1
$self->_list_to_nodes('<html><head><title></title></head><body></body></html>') || (return $self->pass_error)
$self->_list_to_nodes('<html><head><title></title></head><body></body></html>')
Truth table0%0/2
A
A= $self->_list_to_nodes('<html><head><title></title></head><body></body></html>')
| |||||||||||||||||||||||||||||||||||||||||||||||
| 738 | return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 739 | # Remove the DTD | ||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | $self->declaration( undef ); | |||||||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | my $html = $doc->children->first; | |||||||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | ▶ | return( $self->error( "Cannot find the top <html> element in our own standard document for document->open!" ) ) if( !$html ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | ▶ | return( $self->error( "HTML top element found is not a <html> element" ) ) if( $html->tag ne 'html' ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | $html->parent( $self ); | |||||||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | $self->children->reset; | |||||||||||||||||||||||||||||||||||||||||||||
| 746 | 0 | $self->children->push( $html ); | |||||||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | $self->reset(1); | |||||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||
| 749 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||||||
| 751 | # Note: property ownerDocument inherited from HTML::Object::DOM::Node | ||||||||||||||||||||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | ▶ | sub parentElement { return( shift->new_null ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parentElement: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 2 | ▶ | sub parentNode { return( shift->new_null ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parentNode: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 1 | ▶ | sub pictureInPictureElement : lvalue { return( shift->_set_get_object_lvalue( 'pictureinpictureelement', 'HTML::Object::DOM::Element', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pictureInPictureElement: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 1 | ▶ | sub pictureInPictureEnabled : lvalue { return( shift->_set_get_boolean( 'pictureinpictureenabled', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pictureInPictureEnabled: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||||||
| 761 | # Note: property read-only plugins | ||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 1 | ▶ | sub plugins { return( shift->new_collection_elements ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
plugins: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 1 | ▶ | sub pointerLockElement : lvalue { return( shift->_set_get_object_lvalue( 'pointerlockelement', 'HTML::Object::DOM::Element', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pointerLockElement: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||||||||||||||||||||
| 766 | sub prepend | ||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepend: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | ▶ | return( $self ) if( !scalar( @_ ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 770 | # If a HTML::Object::DOM::DocumentFragment object is provided, its children are | ||||||||||||||||||||||||||||||||||||||||||||||
| 771 | # copied to the list and its own children array is emptied. | ||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 0 | ▶ | my $list = $self->_check_list_of_nodes_or_text( @_ ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->_check_list_of_nodes_or_text(@_) || (return $self->pass_error)
MC/DC0%0/1
$self->_check_list_of_nodes_or_text(@_) || (return $self->pass_error)
$self->_check_list_of_nodes_or_text(@_)
Truth table0%0/2
A
A= $self->_check_list_of_nodes_or_text(@_)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | my $nodes = $self->nodes; | |||||||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | ▶ | $self->reset(1) if( !$list->is_empty ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 775 | $list->foreach(sub | ||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 0 | $_->parent( $self ); | |||||||||||||||||||||||||||||||||||||||||||||
| 778 | 0 | }); | |||||||||||||||||||||||||||||||||||||||||||||
| 779 | 0 | $nodes->unshift( $list->list ); | |||||||||||||||||||||||||||||||||||||||||||||
| 780 | 0 | return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||
| 781 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 0 | ▶ | sub previousSibling { return( shift->new_null ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
previousSibling: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 784 | |||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 0 | ▶ | sub queryCommandEnabled { return(0); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
queryCommandEnabled: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 0 | ▶ | sub queryCommandIndeterm { return(1); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
queryCommandIndeterm: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 0 | ▶ | sub queryCommandState { return(0); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
queryCommandState: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 790 | |||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 0 | ▶ | sub queryCommandSupported { return(0); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
queryCommandSupported: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 0 | ▶ | sub queryCommandValue { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
queryCommandValue: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||||||
| 795 | # Note: method querySelector is inherited from HTML::Object::DOM::Element | ||||||||||||||||||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||||||||||||||||
| 797 | # Note: method querySelectorAll is inherited from HTML::Object::DOM::Element | ||||||||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 199 | ▶ | sub readyState : lvalue { return( shift->_set_get_lvalue( 'readyState', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
readyState: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 1 | ▶ | sub referrer : lvalue { return( shift->_set_get_uri( 'referrer', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
referrer: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 802 | |||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | ▶ | sub releaseCapture { return( shift->defaultView->releaseCapture( @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
releaseCapture: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | ▶ | sub releaseEvents { return( shift->defaultView->releaseEvents( @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
releaseEvents: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||||||||||||||||||||
| 807 | # Note: method removeChild is inherited | ||||||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||||||
| 809 | # Note: replaceChild is inherited | ||||||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||||||
| 811 | # Note: the Document replaceChildren() method is different from the HTML::Object::DOM::Element replaceChildren() | ||||||||||||||||||||||||||||||||||||||||||||||
| 812 | sub replaceChildren | ||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replaceChildren: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | ▶ | if( !scalar( @_ ) ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 816 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | $self->nodes->reset; | |||||||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||
| 819 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | my $list = $self->_get_from_list_of_elements_or_html( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 821 | 0 | ▶ | return( $list ) if( $list->is_empty ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | my $html; | |||||||||||||||||||||||||||||||||||||||||||||
| 823 | 0 | foreach my $e ( @$list ) | |||||||||||||||||||||||||||||||||||||||||||||
| 824 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 0 | ▶ | if( $self->_is_a( $e => 'HTML::Object::DOM::Element' ) ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 826 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 0 | ▶ | if( $e->tag eq 'html' ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 828 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 0 | ▶ | if( defined( $html ) ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 830 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 0 | return( $self->error({ | |||||||||||||||||||||||||||||||||||||||||||||
| 832 | message => "You have already provided an <html> element. You can only provide one.", | ||||||||||||||||||||||||||||||||||||||||||||||
| 833 | class => 'HTML::Object::HierarchyRequestError', | ||||||||||||||||||||||||||||||||||||||||||||||
| 834 | }) ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 835 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 836 | else | ||||||||||||||||||||||||||||||||||||||||||||||
| 837 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 0 | $html = $e; | |||||||||||||||||||||||||||||||||||||||||||||
| 839 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 840 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 841 | else | ||||||||||||||||||||||||||||||||||||||||||||||
| 842 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 0 | return( $self->error({ | |||||||||||||||||||||||||||||||||||||||||||||
| 844 | message => "Only the <html> element is allowed inside the Document.", | ||||||||||||||||||||||||||||||||||||||||||||||
| 845 | class => 'HTML::Object::HierarchyRequestError', | ||||||||||||||||||||||||||||||||||||||||||||||
| 846 | }) ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 847 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 848 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 849 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | ▶ | return( $self->error({ | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 851 | message => "You have not provided any <html> element. A document must have at least one <html> element.", | ||||||||||||||||||||||||||||||||||||||||||||||
| 852 | class => 'HTML::Object::HierarchyRequestError', | ||||||||||||||||||||||||||||||||||||||||||||||
| 853 | }) ) if( !defined( $html ) ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 0 | ▶ | return( $self ) if( $list->is_empty ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 0 | my $nodes = $self->nodes; | |||||||||||||||||||||||||||||||||||||||||||||
| 856 | 0 | $nodes->reset; | |||||||||||||||||||||||||||||||||||||||||||||
| 857 | $list->foreach(sub | ||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 0 | $_->detach; | |||||||||||||||||||||||||||||||||||||||||||||
| 860 | 0 | $_->parent( $self ); | |||||||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | }); | |||||||||||||||||||||||||||||||||||||||||||||
| 862 | 0 | $nodes->push( $list->list ); | |||||||||||||||||||||||||||||||||||||||||||||
| 863 | 0 | $self->children->reset; | |||||||||||||||||||||||||||||||||||||||||||||
| 864 | 0 | $self->children->push( $html ); | |||||||||||||||||||||||||||||||||||||||||||||
| 865 | 0 | return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||
| 866 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 0 | ▶ | sub requestStorageAccess { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
requestStorageAccess: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||||||||||||||||||||
| 870 | # Note: property scripts read-only | ||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 1 | ▶ | sub scripts : lvalue | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scripts: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 872 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 1 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 874 | 1 | ▶ | my $results = $self->findNode( 'script' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->findNode('script') || (return $self->pass_error)
MC/DC0%0/1
$self->findNode('script') || (return $self->pass_error)
$self->findNode('script')
Truth table50%1/2
A
A= $self->findNode('script')
| |||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 1 | return( $results ); | |||||||||||||||||||||||||||||||||||||||||||||
| 876 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||||||||||||||||||||
| 878 | # Note: property scrollingElement read-only | ||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 1 | ▶ | sub scrollingElement : lvalue { return( shift->_set_get_object_lvalue( 'scrollingelement', 'HTML::Object::DOM::Element', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scrollingElement: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 880 | |||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 111 | ▶ | sub string_value { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
string_value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 882 | |||||||||||||||||||||||||||||||||||||||||||||||
| 883 | # Note: property styleSheets read-only | ||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 1 | ▶ | sub styleSheets : lvalue | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
styleSheets: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 885 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 1 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 887 | 1 | ▶ | my $list = $self->findNode( 'link[rel="stylesheet"]' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->findNode('link[rel="stylesheet"]') || (return $self->pass_error)
MC/DC0%0/1
$self->findNode('link[rel="stylesheet"]') || (return $self->pass_error)
$self->findNode('link[rel="stylesheet"]')
Truth table50%1/2
A
A= $self->findNode('link[rel="stylesheet"]')
| |||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 1 | ▶ | my $results2 = $self->findNode( 'stylesheet' ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->findNode('stylesheet') || (return $self->pass_error)
MC/DC0%0/1
$self->findNode('stylesheet') || (return $self->pass_error)
$self->findNode('stylesheet')
Truth table50%1/2
A
A= $self->findNode('stylesheet')
| |||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 1 | $list->merge( $results2 ); | |||||||||||||||||||||||||||||||||||||||||||||
| 890 | 1 | return( $list ); | |||||||||||||||||||||||||||||||||||||||||||||
| 891 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||||||
| 893 | # Note: property timeline read-only | ||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 1 | ▶ | sub timeline : lvalue { return; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
timeline: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 895 | |||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 2 | ▶ | sub title : lvalue { return( shift->_set_get_callback({ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
title: called CC=1 SCAR=3.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 897 | get => sub | ||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 2 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 900 | 2 | ▶ | my $results = $self->findNode( 'title' ) || die( $self->error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->findNode('title') || die($self->error)
MC/DC0%0/1
$self->findNode('title') || die($self->error)
$self->findNode('title')
Truth table50%1/2
A
A= $self->findNode('title')
| |||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 2 | ▶ | return if( $results->is_empty ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 2 | return( $results->first->text ); | |||||||||||||||||||||||||||||||||||||||||||||
| 903 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 904 | set => sub | ||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | my $arg = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | ▶ | my $results = $self->findNode( 'title' ) || die( $self->error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->findNode('title') || die($self->error)
MC/DC0%0/1
$self->findNode('title') || die($self->error)
$self->findNode('title')
Truth table0%0/2
A
A= $self->findNode('title')
| |||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | my $e; | |||||||||||||||||||||||||||||||||||||||||||||
| 910 | 0 | ▶ | if( $results->is_empty ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 911 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | ▶ | my $head_results = $self->findNode( 'head' ) || die( $self->error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->findNode('head') || die($self->error)
MC/DC0%0/1
$self->findNode('head') || die($self->error)
$self->findNode('head')
Truth table0%0/2
A
A= $self->findNode('head')
| |||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | ▶ | if( $head_results->is_empty ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 914 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 915 | 0 | die( "Could not find the <head> tag to set as parent of the missing <title>. Something is seriously wrong." ); | |||||||||||||||||||||||||||||||||||||||||||||
| 916 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 0 | my $head = $head_results->first; | |||||||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | $e = $self->createElement( 'title' ); | |||||||||||||||||||||||||||||||||||||||||||||
| 919 | 0 | $e->close; | |||||||||||||||||||||||||||||||||||||||||||||
| 920 | 0 | $head->push( $e ); | |||||||||||||||||||||||||||||||||||||||||||||
| 921 | 0 | $e->parent( $head ); | |||||||||||||||||||||||||||||||||||||||||||||
| 922 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 923 | else | ||||||||||||||||||||||||||||||||||||||||||||||
| 924 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 0 | $e = $results->first; | |||||||||||||||||||||||||||||||||||||||||||||
| 926 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | return( $e->text( $arg ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 929 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 2 | }, @_ ) ); } | |||||||||||||||||||||||||||||||||||||||||||||
| 931 | |||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 1 | ▶ | sub URL : lvalue { return( shift->_set_get_uri( 'uri', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
URL: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 933 | |||||||||||||||||||||||||||||||||||||||||||||||
| 934 | # Note: property visibilityState read-only | ||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 1 | ▶ | sub visibilityState : lvalue { return( shift->_set_get_scalar_as_object( 'visibilitystate', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
visibilityState: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||||||||||||||||||||
| 937 | sub write | ||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 940 | 0 | ▶ | if( $self->{_closed} ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 941 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 0 | ▶ | $self->open() || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 943 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 0 | ▶ | my $body = $self->body || return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->body || (return $self->pass_error)
MC/DC0%0/1
$self->body || (return $self->pass_error)
$self->body
Truth table0%0/2
A
A= $self->body
| |||||||||||||||||||||||||||||||||||||||||||||||
| 945 | # Using _list_to_nodes from HTML::Object::DOM::Node | ||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 0 | my $list = $self->_list_to_nodes( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 947 | $list->foreach(sub | ||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 0 | $_->parent( $body ); | |||||||||||||||||||||||||||||||||||||||||||||
| 950 | 0 | }); | |||||||||||||||||||||||||||||||||||||||||||||
| 951 | 0 | $body->children->push( $list->list ); | |||||||||||||||||||||||||||||||||||||||||||||
| 952 | 0 | return( $list ); | |||||||||||||||||||||||||||||||||||||||||||||
| 953 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 954 | |||||||||||||||||||||||||||||||||||||||||||||||
| 955 | sub writeln | ||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
writeln: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 958 | 0 | my @args = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 959 | 0 | for( @args ) | |||||||||||||||||||||||||||||||||||||||||||||
| 960 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 0 | ▶ | next if( ref( $_ ) && !overload::Method( $_, '""' ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $_ and not overload::Method($_, "\"\"")
MC/DC0%0/2
ref $_ and not overload::Method($_, "\"\"")
ref $_
not overload::Method($_, "\"\"")
Truth table0%0/3
A and not(B)
A= ref $_B= not overload::Method($_, "\"\"")
| |||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 0 | ▶ | $_ .= "\n" unless( /\n$/ ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 963 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 0 | return( $self->write( @args ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 965 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 966 | |||||||||||||||||||||||||||||||||||||||||||||||
| 967 | sub _check_list_of_nodes_or_text | ||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_list_of_nodes_or_text: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||
| 969 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 970 | # If a HTML::Object::DOM::DocumentFragment object is provided, its children are | ||||||||||||||||||||||||||||||||||||||||||||||
| 971 | # copied to the list and its own children array is emptied. | ||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 0 | my $list = $self->_get_from_list_of_elements_or_html( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 973 | 0 | ▶ | return( $list ) if( $list->is_empty ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 974 | 0 | my $html = $self->documentElement; | |||||||||||||||||||||||||||||||||||||||||||||
| 975 | 0 | foreach my $e ( @$list ) | |||||||||||||||||||||||||||||||||||||||||||||
| 976 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | ▶ | if( $self->_is_a( $e => 'HTML::Object::DOM::Element' ) ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 978 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 979 | # There can be only one element in the document: the <html> element. | ||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 0 | ▶ | if( ref( $html ) ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 981 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 0 | return( $self->error({ | |||||||||||||||||||||||||||||||||||||||||||||
| 983 | message => "Cannot have more than one Element child of a Document and it must be an <html> element.", | ||||||||||||||||||||||||||||||||||||||||||||||
| 984 | class => 'HTML::Object::HierarchyRequestError', | ||||||||||||||||||||||||||||||||||||||||||||||
| 985 | }) ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 986 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 987 | elsif( $e->tag ne 'html' ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 988 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 0 | return( $self->error({ | |||||||||||||||||||||||||||||||||||||||||||||
| 990 | message => "Only the <html> element is allowed inside the Document.", | ||||||||||||||||||||||||||||||||||||||||||||||
| 991 | class => 'HTML::Object::HierarchyRequestError', | ||||||||||||||||||||||||||||||||||||||||||||||
| 992 | }) ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 993 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 994 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 995 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 0 | return( $list ); | |||||||||||||||||||||||||||||||||||||||||||||
| 997 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 998 | |||||||||||||||||||||||||||||||||||||||||||||||
| 999 | sub _init_nodes | ||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 467 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_init_nodes: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 467 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 467 | ▶ | unless( CORE::exists( $self->{nodes} ) ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 72 | my $children = $self->_set_get_object_array_object( 'children', 'HTML::Object::Element' ); | |||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 72 | $self->{nodes} = $children; | |||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 72 | ▶ | my $html = $children->grep(sub{ $self->_is_a( $_ => 'HTML::Object::DOM::Node' ) && $_->tag eq 'html' })->first; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | # We have a document with an <html> tag, we change the children to be an array with just the <html> element | ||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | # and we set nodes to be the array containing all top nodes. | ||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | # Maybe, we should change that structural design in the future to make it better | ||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 72 | ▶ | if( $html ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 0 | my $new_children = $self->new_array( $html ); | |||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 0 | $self->_set_get_object_array_object( 'children', 'HTML::Object::Element', $new_children ); | |||||||||||||||||||||||||||||||||||||||||||||
| 1014 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 467 | return( $self->{nodes} ); | |||||||||||||||||||||||||||||||||||||||||||||
| 1017 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 0 | ▶ | sub _set_get_on_signal : lvalue | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_set_get_on_signal: not called CC=14 SCAR=53.5
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 0 | ▶ | my $sigs = shift( @_ ) || return; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift @_ || (return)
MC/DC0%0/1
shift @_ || (return)
shift @_
Truth table0%0/2
A
A= shift @_
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 0 | ▶ | return if( ref( $sigs ) ne 'ARRAY' ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 0 | my $has_arg = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 0 | my $arg; | |||||||||||||||||||||||||||||||||||||||||||||
| 1026 | 0 | ▶ | if( want( qw( LVALUE ASSIGN ) ) ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 0 | ( $arg ) = want( 'ASSIGN' ); | |||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 0 | $has_arg = 'assign'; | |||||||||||||||||||||||||||||||||||||||||||||
| 1030 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | else | ||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 0 | ▶ | @_ = () if( scalar( @_ ) == 1 && !defined( $_[0] ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
scalar @_ == 1 and not defined $_[0]
MC/DC0%0/2
scalar @_ == 1 and not defined $_[0]
scalar @_ == 1
not defined $_[0]
Truth table0%0/3
A and not(B)
A= scalar @_ == 1B= not defined $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | 0 | ▶ | if( @_ ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 0 | $arg = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 0 | $has_arg++; | |||||||||||||||||||||||||||||||||||||||||||||
| 1038 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | # To empty it, it must be set to an empty string | ||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | 0 | ▶ | if( $has_arg && defined( $arg ) ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$has_arg and defined $arg
MC/DC0%0/2
$has_arg and defined $arg
$has_arg
defined $arg
Truth table0%0/3
A and B
A= $has_argB= defined $arg
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 0 | my $code = $arg; | |||||||||||||||||||||||||||||||||||||||||||||
| 1044 | 0 | ▶ | if( ref( $code ) ne 'CODE' ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 0 | my $error = "Value provided is not a code reference (reference to a subroutine or anonymous subroutine)."; | |||||||||||||||||||||||||||||||||||||||||||||
| 1047 | 0 | ▶ | if( $has_arg eq 'assign' ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | 0 | $self->error({ message => $error, class => 'HTML::Object::TypeError' }); | |||||||||||||||||||||||||||||||||||||||||||||
| 1050 | 0 | return( $self->{__lvalue_error} = undef ); | |||||||||||||||||||||||||||||||||||||||||||||
| 1051 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | 0 | ▶ | return( $self->error({ message => $error, class => 'HTML::Object::TypeError' }) ) if( want( 'LVALUE' ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 0 | Wanted::rreturn( $self->error({ message => $error, class => 'HTML::Object::TypeError' }) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 1054 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | 0 | foreach my $sig ( @$sigs ) | |||||||||||||||||||||||||||||||||||||||||||||
| 1056 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | $SIG{ $sig } = sub | ||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | 0 | my $type; | |||||||||||||||||||||||||||||||||||||||||||||
| 1060 | 0 | ▶ | if( $sig eq '__WARN__' || $sig eq '__DIE__' ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$sig eq "__WARN__" or $sig eq "__DIE__"
MC/DC0%0/2
$sig eq "__WARN__" or $sig eq "__DIE__"
$sig eq "__WARN__"
$sig eq "__DIE__"
Truth table0%0/3
A or B
A= $sig eq "__WARN__"B= $sig eq "__DIE__"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 0 | ( $type = $sig ) =~ s/^__([A-Z]+)__$/$1/; | |||||||||||||||||||||||||||||||||||||||||||||
| 1063 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | else | ||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | 0 | $type = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 1067 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 0 | my $event = HTML::Object::ErrorEvent->new( $type, @_ ); | |||||||||||||||||||||||||||||||||||||||||||||
| 1069 | 0 | $code->( $event ); | |||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 1071 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | 0 | my $dummy = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 1074 | 0 | ▶ | return( $dummy ) if( want( 'LVALUE' ) ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | 0 | Wanted::rreturn( $dummy ); | |||||||||||||||||||||||||||||||||||||||||||||
| 1076 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | |||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | 35 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 1079 | # NOTE: POD | ||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||