blib/lib/HTML5/DOM/Node.pm

filter: Statementstmt 94.4% 68 / 72 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 92.8% 26 / 28 Podpod n/a totaltotal 89.7% 96 / 107 SCAR 11.0
CC
3
Cov
91%
__ANON__
2.5
__ANON__
2.1
DELETE
2.0
CRAP 3.0
« blib/lib/HTML5/DOM/Tree.pm ↑ Summary blib/lib/HTML5/DOM/CSS/Selector.pm »
1 package HTML5::DOM::Node;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 use overload
6 9 ▶ '""' => sub { $_[0]->html },
Subroutine __ANON__: called CC=1 SCAR=0.0
7 1 ▶ '@{}' => sub { $_[0]->childrenNode->array },
Subroutine __ANON__: called CC=1 SCAR=0.0
8 '%{}' => \&__attrHashAccess,
9 193 ▶ '==' => sub { defined $_[1] && $_[0]->isSameNode($_[1]) },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
defined $_[1] and $_[0]->isSameNode($_[1]) 193 0 193
10 26 ▶ '!=' => sub { !defined $_[1] || !$_[0]->isSameNode($_[1]) },
Subroutine __ANON__: called CC=2 SCAR=9.2
Condition33%1/3
defined $_[1] && $_[0]->isSameNode($_[1])
!ll&&!rl&&r
0260
MC/DC0%0/2
defined $_[1] && $_[0]->isSameNode($_[1])
defined $_[1] $_[0]->isSameNode($_[1])
Truth table33%1/3
A && B
A= defined $_[1]B= $_[0]->isSameNode($_[1])
ABresult
0X0
100
111
11 56 ▶ 'bool' => sub { 1 },
Subroutine __ANON__: called CC=1 SCAR=0.0
12 3 ▶ fallback => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 # https://developer.mozilla.org/pl/docs/Web/API/Element/nodeType
15 3 ▶use constant ELEMENT_NODE => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 3 ▶use constant ATTRIBUTE_NODE => 2; # not supported
Subroutine BEGIN: called CC=1 SCAR=0.0
17 3 ▶use constant TEXT_NODE => 3;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 3 ▶use constant CDATA_SECTION_NODE => 4; # not supported
Subroutine BEGIN: called CC=1 SCAR=0.0
19 3 ▶use constant ENTITY_REFERENCE_NODE => 5; # not supported
Subroutine BEGIN: called CC=1 SCAR=0.0
20 3 ▶use constant ENTITY_NODE => 6; # not supported
Subroutine BEGIN: called CC=1 SCAR=0.0
21 3 ▶use constant PROCESSING_INSTRUCTION_NODE => 7; # not supported
Subroutine BEGIN: called CC=1 SCAR=0.0
22 3 ▶use constant COMMENT_NODE => 8;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 3 ▶use constant DOCUMENT_NODE => 9;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 3 ▶use constant DOCUMENT_TYPE_NODE => 10;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 3 ▶use constant DOCUMENT_FRAGMENT_NODE => 11;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 3 ▶use constant NOTATION_NODE => 12; # not supported
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 sub __attrHashAccess {
29 7 ▶ my $self = shift;
Subroutine __attrHashAccess: called CC=1 SCAR=0.0
30 7 my %h;
31 7 tie %h, 'HTML5::DOM::Node::_AttrHashAccess', $self;
32 7 return \%h;
33 }
34  
35 3 1;
36  
37 package HTML5::DOM::Node::_AttrHashAccess;
38 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
39 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
40  
41 sub TIEHASH {
42 7 ▶ my $p = shift;
Subroutine TIEHASH: called CC=1 SCAR=0.0
43 7 bless \shift, $p
44 }
45  
46 sub EXISTS {
47 1 ▶ defined ${shift()}->attr(shift);
Subroutine EXISTS: called CC=1 SCAR=0.0
48 }
49  
50 sub DELETE {
51 0 ▶ ${shift()}->removeAttr(shift);
Subroutine DELETE: not called CC=1 SCAR=6.9
52 }
53  
54 sub FETCH {
55 6 ▶ ${shift()}->attr(shift);
Subroutine FETCH: called CC=1 SCAR=0.0
56 }
57  
58 sub STORE {
59 0 ▶ ${shift()}->attr(shift, shift);
Subroutine STORE: not called CC=1 SCAR=6.9
60 }
61  
62 3 1;
« blib/lib/HTML5/DOM/Tree.pm ↑ Summary blib/lib/HTML5/DOM/CSS/Selector.pm »