Object/DOM/NodeIteratorShared.pm

filter: Statementstmt 95.1% 138 / 145 Branchbran 68.3% 41 / 60 Conditioncond 56.8% 50 / 88 MC/DCmcdc 5.7% 2 / 35 Subroutinesub 86.9% 20 / 23 Podpod 100% 8 / 8 totaltotal 72.1% 259 / 359 CC 62 SCAR 29.7
CC
62
Cov
78%
_check_element
41.7
init
20.8
nextNode
11.0
CRAP 19.4
« Object/DOM/Implementation.pm ↑ Summary Object/DOM/VideoTrackList.pm »
1 ##----------------------------------------------------------------------------
2 ## HTML Object - ~/lib/HTML/Object/DOM/NodeIteratorShared.pm
3 ## Version v0.2.0
4 ## Copyright(c) 2021 DEGUEST Pte. Ltd.
5 ## Author: Jacques Deguest <jack@deguest.jp>
6 ## Created 2021/12/20
7 ## Modified 2022/09/18
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::NodeIteratorShared;
15 BEGIN
16 3 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
17 3 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 3 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 3 warnings::register_categories( 'HTML::Object' );
20 3 ▶ use parent qw( Module::Generic );
Subroutine BEGIN: called CC=1 SCAR=0.0
21 3 ▶ use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
22 # To import its constants
23 3 ▶ use HTML::Object::DOM::Node;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 3 ▶ use HTML::Object::DOM::NodeFilter qw( :all );
Subroutine BEGIN: called CC=1 SCAR=0.0
25 3 our $VERSION = 'v0.2.0';
26 };
27  
28 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 sub init
32 10 ▶{
Subroutine init: called CC=17 SCAR=30.3
Pod documented
33 10 my $self = shift( @_ );
34 10 ▶ return( $self->error({
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ < 1 0 10 10
35 message => sprintf( "Expected at least 1 arguments, but only got %d.", scalar( @_ ) ),
36 class => 'HTML::Object::SyntaxError',
37 }) ) if( scalar( @_ ) < 1 );
38 10 my $root = shift( @_ );
39 10 my $what = shift( @_ );
40 10 my( $filterDef, $filter );
41 10 ▶ $filterDef = shift( @_ ) if( ref( $_[0] ) eq 'CODE' );
Branch: 1 branch
BranchTrueFalseTotal
if ref $_[0] eq "CODE" 4 6 10
42 10 my $opts = $self->_get_args_as_hash( @_ );
43 10 ▶ return( $self->error({
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_is_a($root, "HTML::Object::DOM::Node") 0 10 10
44 message => "Root node provided is not a HTML::Object::DOM::Node object.",
45 class => 'HTML::Object::TypeError',
46 }) ) if( !$self->_is_a( $root => 'HTML::Object::DOM::Node' ) );
47 10 ▶ $what = HTML::Object::DOM::NodeFilter::SHOW_ALL if( !defined( $what ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $what 0 10 10
48 # Default value
49 10 ▶ if( !defined( $filterDef ) )
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $filterDef) 6 4 10
50 {
51 6 $filterDef = HTML::Object::DOM::NodeFilter->new;
52 }
53  
54 10 ▶ return( $self->error({
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_is_integer($what) 0 10 10
55 message => "Value provided for what to show is not an integer.",
56 class => 'HTML::Object::TypeError',
57 }) ) if( !$self->_is_integer( $what ) );
58 10 ▶ if( scalar( keys( %$opts ) ) )
Branch: 1 branch
BranchTrueFalseTotal
if (scalar keys %$opts) 4 6 10
59 {
60 return( $self->error({
61 message => "Filter parameter provided is an hash reference, but it does not have a \"acceptNode\" property or that property is not a code reference.",
62 class => 'HTML::Object::TypeError',
63 4 ▶ }) ) if( !defined( $filterDef ) && ( !exists( $opts->{acceptNode} ) || ref( $opts->{acceptNode} ) ne 'CODE' ) );
Branch: 1 branch
BranchTrueFalseTotal
if not defined $filterDef and !exists $opts->{"acceptNode"} || ref $opts->{"acceptNode"} ne "CODE" 0 4 4
Condition16%1/6
not defined $filterDef and !exists $opts->{"acceptNode"} || ref $opts->{"acceptNode"} ne "CODE"
!ll&&!rl&&r
400
not exists $opts->{"acceptNode"} or ref $opts->{"acceptNode"} ne "CODE"
l!l&&r!l&&!r
000
MC/DC0%0/3
not defined $filterDef and !exists $opts->{"acceptNode"} || ref $opts->{"acceptNode"} ne "CODE"
not defined $filterDef not exists $opts->{"acceptNode"} ref $opts->{"acceptNode"} ne "CODE"
Truth table25%1/4
not(A) and not(B) or C
A= not defined $filterDefB= not exists $opts->{"acceptNode"}C= ref $opts->{"acceptNode"} ne "CODE"
ABCresult
0XX0
1000
11X1
1011
64 4 ▶ $filterDef = CORE::delete( $opts->{acceptNode} ) if( CORE::exists( $opts->{acceptNode} ) && ref( $opts->{acceptNode} ) eq 'CODE' );
Branch: 1 branch
BranchTrueFalseTotal
if exists $opts->{"acceptNode"} and ref $opts->{"acceptNode"} eq "CODE" 0 4 4
Condition33%1/3
exists $opts->{"acceptNode"} and ref $opts->{"acceptNode"} eq "CODE"
!ll&&!rl&&r
400
MC/DC0%0/2
exists $opts->{"acceptNode"} and ref $opts->{"acceptNode"} eq "CODE"
exists $opts->{"acceptNode"} ref $opts->{"acceptNode"} eq "CODE"
Truth table33%1/3
A and B
A= exists $opts->{"acceptNode"}B= ref $opts->{"acceptNode"} eq "CODE"
ABresult
0X0
100
111
65 }
66  
67 10 ▶ if( $self->_is_object( $filterDef ) )
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_is_object($filterDef)) { } 6 4 10
68 {
69 6 ▶ return( $self->error({
Branch: 1 branch
BranchTrueFalseTotal
unless $filterDef->can("acceptNode") 0 6 6
70 message => "Object provided does not implement the \"acceptNode\" method.",
71 class => 'HTML::Object::TypeError',
72 }) ) if( !$filterDef->can( 'acceptNode' ) );
73 6 ▶ $filter = sub{ return( $filterDef->acceptNode( @_ ) ); };
Subroutine __ANON__: called CC=1 SCAR=0.0
74 }
75 else
76 {
77 4 ▶ return( $self->error({
Branch: 1 branch
BranchTrueFalseTotal
if ref $filterDef ne "CODE" 0 4 4
78 message => "Filter parameter provided is not a code reference.",
79 class => 'HTML::Object::TypeError',
80 }) ) if( ref( $filterDef ) ne 'CODE' );
81 4 $filter = $filterDef;
82 }
83 10 $self->{_init_strict_use_sub} = 1;
84 10 ▶ $self->SUPER::init( @_ ) || return( $self->pass_error );
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init(@_) or return $self->pass_error 10 0 10
85 10 $self->{children} = [];
86 10 $self->{pointerbeforereferencenode} = 1;
87 10 $self->root( $root );
88 10 $self->whatToShow( $what );
89 10 $self->filter( $filter );
90 10 $self->{_parent} = $root;
91 # This is the position of our cursor in the flatten tree represented by an array of all elements
92 10 $self->{_pos} = 0;
93 10 my $elems = $self->_flatten;
94 10 $self->_elements( $elems );
95 10 return( $self );
96 }
97  
98 # Note: property expandEntityReferences read-only
99 0 ▶sub expandEntityReferences : lvalue { return( shift->_set_get_boolean( 'expandentityreferences', @_ ) ); }
Subroutine expandEntityReferences: not called CC=1 SCAR=6.9
Pod documented
100  
101 # Note: property filter read-only
102 64 ▶sub filter : lvalue { return( shift->_set_get_code( 'filter', @_ ) ); }
Subroutine filter: called CC=1 SCAR=0.0
Pod documented
103  
104 sub nextNode
105 40 ▶{
Subroutine nextNode: called CC=10 SCAR=24.0
Pod documented
106 40 my $self = shift( @_ );
107 40 my $elems = $self->_elements;
108 # Would be -1 if empty
109 40 my $size = $elems->size;
110 # We reached the end of this array
111 40 ▶ return if( $self->{_pos} >= $size );
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_pos"} >= $size 0 40 40
112 40 my $whattoshow = $self->whatToShow;
113 40 ▶ return( $self->error( "Somehow the bitwise value of what to show (", ( $whattoshow // 'undef' ), ") is not an integer!" ) ) if( !$self->_is_integer( $whattoshow ) );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_is_integer($whattoshow) 0 40 40
Condition0%0/2
$whattoshow // "undef"
l!l
00
MC/DC0%0/1
$whattoshow // "undef"
$whattoshow
Truth table0%0/2
A
A= $whattoshow
Aresult
11
00
114 40 my $filter = $self->filter;
115 40 my $class = ref( $self );
116 # Somehow it has been changed maybe? End our iteration
117 40 ▶ if( ref( $filter ) ne 'CODE' )
Branch: 1 branch
BranchTrueFalseTotal
if (ref $filter ne "CODE") 0 40 40
118 {
119 0 $self->{_pos} = $size;
120 0 return( $self->error({
121 message => "Filter is not a code reference!",
122 class => 'HTML::Object::TypeError',
123 }) );
124 }
125 40 my $node;
126 40 my $tmpPos = $self->{_pos} + 1;
127 40 while(1)
128 {
129 # We reached the end of the array
130 145 ▶ last if( $tmpPos > $size );
Branch: 1 branch
BranchTrueFalseTotal
if $tmpPos > $size 5 140 145
131 140 my $tmpNode = $elems->index( $tmpPos );
132 140 my $type = $tmpNode->nodeType;
133 140 ▶ $tmpPos++, next if( !$self->_check_element( $tmpNode ) );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_check_element($tmpNode) 71 69 140
134 # This is for the pos() method
135 69 $self->{_relative_pos} = $tmpNode->parent->children->pos( $tmpNode );
136 69 local $_ = $tmpNode;
137 69 my $rv = $filter->( $tmpNode );
138 # Filter should return FILTER_ACCEPT or FILTER_REJECT or FILTER_SKIP
139 69 ▶ $tmpPos++, next if( !defined( $rv ) || $rv == FILTER_REJECT || $rv == FILTER_SKIP );
Branch: 1 branch
BranchTrueFalseTotal
if not defined $rv or $rv == 2 or $rv == 3 34 35 69
Condition50%3/6
not defined $rv or $rv == 2 or $rv == 3
l!l&&r!l&&!r
03435
not defined $rv or $rv == 2
l!l&&r!l&&!r
0069
MC/DC33%1/3
not defined $rv or $rv == 2 or $rv == 3
not defined $rv $rv == 2 $rv == 3
Truth table50%2/4
not(A) or B or C
A= not defined $rvB= $rv == 2C= $rv == 3
ABCresult
1XX1
01X1
0011
0000
140 35 $node = $tmpNode;
141 35 $self->{_pos} = $tmpPos;
142 35 last;
143 }
144 # Return the node to our caller
145 40 return( $node );
146 }
147  
148 0 ▶sub pos { return( shift->{_relative_pos} ); }
Subroutine pos: not called CC=1 SCAR=6.9
Pod documented
149  
150 sub previousNode
151 16 ▶{
Subroutine previousNode: called CC=9 SCAR=22.7
Pod documented
152 16 my $self = shift( @_ );
153 16 my $elems = $self->_elements;
154 # Would be -1 if empty
155 16 my $size = $elems->size;
156 # Already at the beginning
157 16 ▶ return if( $self->{_pos} <= 0 );
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_pos"} <= 0 2 14 16
158 14 my $whattoshow = $self->whatToShow;
159 14 ▶ return( $self->error( "Somehow the bitwise value of what to show is not an integer!" ) ) if( !$self->_is_integer( $whattoshow ) );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_is_integer($whattoshow) 0 14 14
160 14 my $filter = $self->filter;
161 14 my $class = ref( $self );
162 # Somehow it has been changed maybe? End our iteration
163 14 ▶ if( ref( $filter ) ne 'CODE' )
Branch: 1 branch
BranchTrueFalseTotal
if (ref $filter ne "CODE") 0 14 14
164 {
165 0 $self->{_pos} = $size;
166 0 return( $self->error({
167 message => "Filter is not a code reference!",
168 class => 'HTML::Object::TypeError',
169 }) );
170 }
171 14 my $node;
172 14 my $tmpPos = $self->{_pos} - 1;
173 14 while(1)
174 {
175 # We reached the start of the array
176 44 ▶ last if( $tmpPos < 0 );
Branch: 1 branch
BranchTrueFalseTotal
if $tmpPos < 0 0 44 44
177 44 my $tmpNode = $elems->index( $tmpPos );
178 44 my $type = $tmpNode->nodeType;
179 44 ▶ $tmpPos--, next if( !$self->_check_element( $tmpNode ) );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_check_element($tmpNode) 0 44 44
180 # This is for the pos() method
181 44 $self->{_relative_pos} = $tmpNode->parent->children->pos( $tmpNode );
182 44 local $_ = $tmpNode;
183 44 my $rv = $filter->( $tmpNode );
184 # Filter should return FILTER_ACCEPT or FILTER_REJECT or FILTER_SKIP
185 44 ▶ $tmpPos--, next if( !defined( $rv ) || $rv == FILTER_REJECT || $rv == FILTER_SKIP );
Branch: 1 branch
BranchTrueFalseTotal
if not defined $rv or $rv == 2 or $rv == 3 30 14 44
Condition50%3/6
not defined $rv or $rv == 2 or $rv == 3
l!l&&r!l&&!r
03014
not defined $rv or $rv == 2
l!l&&r!l&&!r
0044
MC/DC33%1/3
not defined $rv or $rv == 2 or $rv == 3
not defined $rv $rv == 2 $rv == 3
Truth table50%2/4
not(A) or B or C
A= not defined $rvB= $rv == 2C= $rv == 3
ABCresult
1XX1
01X1
0011
0000
186 14 $node = $tmpNode;
187 # Decrement the position for the next turn
188 14 $self->{_pos} = $tmpPos;
189 14 last;
190 }
191 # Return the node to our caller
192 14 return( $node );
193 }
194  
195 # Note: property root read-only
196 25 ▶sub root : lvalue { return( shift->_set_get_object_lvalue( 'root', 'HTML::Object::DOM::Node', @_ ) ); }
Subroutine root: called CC=1 SCAR=0.0
Pod documented
197  
198 # Note: property whatToShow read-only
199 258 ▶sub whatToShow : lvalue { return( shift->_set_get_number( 'whattoshow', @_ ) ); }
Subroutine whatToShow: called CC=1 SCAR=0.0
Pod documented
200  
201 sub _check_element
202 191 ▶{
Subroutine _check_element: called CC=25 SCAR=37.3
203 191 my $self = shift( @_ );
204 191 ▶ my $node = shift( @_ ) || return;
Condition50%1/2
shift @_ || (return)
l!l
1910
MC/DC0%0/1
shift @_ || (return)
shift @_
Truth table50%1/2
A
A= shift @_
Aresult
11
00
205 191 my $type = $node->nodeType;
206 191 my $whattoshow = $self->whatToShow;
207 191 ▶ unless( $whattoshow == SHOW_ALL )
Branch: 1 branch
BranchTrueFalseTotal
unless ($whattoshow == 4294967295) 98 93 191
208 {
209 98 ▶ if( ( $type == ELEMENT_NODE && !( $whattoshow & SHOW_ELEMENT ) ) ||
Branch: 1 branch
BranchTrueFalseTotal
if ($type == 1 and not $whattoshow & 1 or $type == 2 and not $whattoshow & 2 or $type == 3 and not $whattoshow & 4 or $type == 4 and not $whattoshow & 8 or $type == 7 and not $whattoshow & 64 or $type == 8 and not $whattoshow & 128 or $type == 9 and not $whattoshow & 256 or $type == 10 and not $whattoshow & 512 or $type == 11 and not $whattoshow & 1024 or $type == 12 and not $whattoshow & 2048 or $type == 13 and not $whattoshow & 4096) 74 24 98
Condition65%41/63
$type == 1 and not $whattoshow & 1 or $type == 2 and not $whattoshow & 2 or $type == 3 and not $whattoshow & 4 or $type == 4 and not $whattoshow & 8 or $type == 7 and not $whattoshow & 64 or $type == 8 and not $whattoshow & 128 or $type == 9 and not $whattoshow & 256 or $type == 10 and not $whattoshow & 512 or $type == 11 and not $whattoshow & 1024 or $type == 12 and not $whattoshow & 2048 or $type == 13 and not $whattoshow & 4096
l!l&&r!l&&!r
334124
$type == 1 and not $whattoshow & 1 or $type == 2 and not $whattoshow & 2 or $type == 3 and not $whattoshow & 4 or $type == 4 and not $whattoshow & 8 or $type == 7 and not $whattoshow & 64 or $type == 8 and not $whattoshow & 128 or $type == 9 and not $whattoshow & 256 or $type == 10 and not $whattoshow & 512 or $type == 11 and not $whattoshow & 1024 or $type == 12 and not $whattoshow & 2048
l!l&&r!l&&!r
33065
$type == 1 and not $whattoshow & 1 or $type == 2 and not $whattoshow & 2 or $type == 3 and not $whattoshow & 4 or $type == 4 and not $whattoshow & 8 or $type == 7 and not $whattoshow & 64 or $type == 8 and not $whattoshow & 128 or $type == 9 and not $whattoshow & 256 or $type == 10 and not $whattoshow & 512 or $type == 11 and not $whattoshow & 1024
l!l&&r!l&&!r
33065
$type == 1 and not $whattoshow & 1 or $type == 2 and not $whattoshow & 2 or $type == 3 and not $whattoshow & 4 or $type == 4 and not $whattoshow & 8 or $type == 7 and not $whattoshow & 64 or $type == 8 and not $whattoshow & 128 or $type == 9 and not $whattoshow & 256 or $type == 10 and not $whattoshow & 512
l!l&&r!l&&!r
33065
$type == 1 and not $whattoshow & 1 or $type == 2 and not $whattoshow & 2 or $type == 3 and not $whattoshow & 4 or $type == 4 and not $whattoshow & 8 or $type == 7 and not $whattoshow & 64 or $type == 8 and not $whattoshow & 128 or $type == 9 and not $whattoshow & 256
l!l&&r!l&&!r
33065
$type == 1 and not $whattoshow & 1 or $type == 2 and not $whattoshow & 2 or $type == 3 and not $whattoshow & 4 or $type == 4 and not $whattoshow & 8 or $type == 7 and not $whattoshow & 64 or $type == 8 and not $whattoshow & 128
l!l&&r!l&&!r
30365
$type == 1 and not $whattoshow & 1 or $type == 2 and not $whattoshow & 2 or $type == 3 and not $whattoshow & 4 or $type == 4 and not $whattoshow & 8 or $type == 7 and not $whattoshow & 64
l!l&&r!l&&!r
30068
$type == 1 and not $whattoshow & 1 or $type == 2 and not $whattoshow & 2 or $type == 3 and not $whattoshow & 4 or $type == 4 and not $whattoshow & 8
l!l&&r!l&&!r
30068
$type == 1 and not $whattoshow & 1 or $type == 2 and not $whattoshow & 2 or $type == 3 and not $whattoshow & 4
l!l&&r!l&&!r
131768
$type == 1 and not $whattoshow & 1 or $type == 2 and not $whattoshow & 2
l!l&&r!l&&!r
13085
$type == 1 and not $whattoshow & 1
!ll&&!rl&&r
681713
$type == 2 and not $whattoshow & 2
!ll&&!rl&&r
8500
$type == 3 and not $whattoshow & 4
!ll&&!rl&&r
62617
$type == 4 and not $whattoshow & 8
!ll&&!rl&&r
6800
$type == 7 and not $whattoshow & 64
!ll&&!rl&&r
6800
$type == 8 and not $whattoshow & 128
!ll&&!rl&&r
6413
$type == 9 and not $whattoshow & 256
!ll&&!rl&&r
6500
$type == 10 and not $whattoshow & 512
!ll&&!rl&&r
6500
$type == 11 and not $whattoshow & 1024
!ll&&!rl&&r
6500
$type == 12 and not $whattoshow & 2048
!ll&&!rl&&r
6500
$type == 13 and not $whattoshow & 4096
!ll&&!rl&&r
24041
MC/DC0%0/22
$type == 1 and not $whattoshow & 1 or $type == 2 and not $whattoshow & 2 or $type == 3 and not $whattoshow & 4 or $type == 4 and not $whattoshow & 8 or $type == 7 and not $whattoshow & 64 or $type == 8 and not $whattoshow & 128 or $type == 9 and not $whattoshow & 256 or $type == 10 and not $whattoshow & 512 or $type == 11 and not $whattoshow & 1024 or $type == 12 and not $whattoshow & 2048 or $type == 13 and not $whattoshow & 4096
too many conditions
210 ( $type == ATTRIBUTE_NODE && !( $whattoshow & SHOW_ATTRIBUTE ) ) ||
211 ( $type == TEXT_NODE && !( $whattoshow & SHOW_TEXT ) ) ||
212 ( $type == CDATA_SECTION_NODE && !( $whattoshow & SHOW_CDATA_SECTION ) ) ||
213 ( $type == PROCESSING_INSTRUCTION_NODE && !( $whattoshow & SHOW_PROCESSING_INSTRUCTION ) ) ||
214 ( $type == COMMENT_NODE && !( $whattoshow & SHOW_COMMENT ) ) ||
215 ( $type == DOCUMENT_NODE && !( $whattoshow & SHOW_DOCUMENT ) ) ||
216 ( $type == DOCUMENT_TYPE_NODE && !( $whattoshow & SHOW_DOCUMENT_TYPE ) ) ||
217 ( $type == DOCUMENT_FRAGMENT_NODE && !( $whattoshow & SHOW_DOCUMENT_FRAGMENT ) ) ||
218 # Notation nodes are deprecated, but we list them here anyway
219 ( $type == NOTATION_NODE && !( $whattoshow & SHOW_NOTATION ) ) ||
220 # This is a non-standard addition to provide more granularity
221 ( $type == SPACE_NODE && !( $whattoshow & SHOW_SPACE ) ) )
222 {
223 74 return(0);
224 }
225 }
226 117 return(1);
227 }
228  
229 88 ▶sub _elements { return( shift->_set_get_array_as_object( '_elements', @_ ) ); }
Subroutine _elements: called CC=1 SCAR=0.0
230  
231 sub _flatten
232 10 ▶{
Subroutine _flatten: called CC=2 SCAR=7.0
233 10 my $self = shift( @_ );
234 10 my $root = $self->root;
235 # Should not happen
236 10 ▶ return( $self->error( "root element is gone!" ) ) if( !defined( $root ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $root 0 10 10
237 10 my $elems = $self->new_array;
238 10 my $seen = {};
239 10 my $crawl;
240 $crawl = sub
241 250 ▶ {
Subroutine __ANON__: called CC=4 SCAR=14.0
242 250 my $e = shift( @_ );
243 250 my $addr = $self->_refaddr( $e );
244 250 ▶ return if( ++$seen->{ $addr } > 1 );
Branch: 1 branch
BranchTrueFalseTotal
if ++$seen->{$addr} > 1 0 250 250
245 250 my $kids = $e->children;
246 250 foreach my $kid ( @$kids )
247 {
248 # Junk somehow although it should not happen
249 240 ▶ next if( !$self->_is_a( $kid => 'HTML::Object::DOM::Node' ) );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_is_a($kid, "HTML::Object::DOM::Node") 0 240 240
250 240 $elems->push( $kid );
251 # Drill down...
252 240 $crawl->( $kid );
253 }
254 10 };
255 10 $elems->push( $root );
256 10 $crawl->( $root );
257 10 return( $elems );
258 }
259  
260 0 ▶sub _parent { return( shift->_set_get_object_without_init( '_parent', 'HTML::Object::DOM::Node', @_ ) ); }
Subroutine _parent: not called CC=1 SCAR=6.9
261  
262 3 1;
263 # NOTE: POD
264 __END__
« Object/DOM/Implementation.pm ↑ Summary Object/DOM/VideoTrackList.pm »