DOM/Implementation.pm

filter: Statementstmt 92.8% 13 / 14 Branchbran 100% 2 / 2 Conditioncond 83.3% 5 / 6 MC/DCmcdc 75.0% 3 / 4 Subroutinesub 75.0% 3 / 4 Podpod 50.0% 1 / 2 totaltotal 84.3% 27 / 32 SCAR 13.9
CC
4
Cov
91%
hasFeature
4.0
add_feature
2.0
BEGIN
1.0
CRAP 4.0
« DOM/Comment.pm ↑ Summary DOM/View.pm »
1 package HTML::DOM::Implementation;
2  
3 29 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 29 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 29 our $VERSION = '0.057';
7  
8 29 our $it = bless do{\my$x};
9  
10 29 my %features = (
11 html => { '1.0' => 1, '2.0' => 1 },
12 core => { '1.0' => 1, '2.0' => 1 },
13 events => { '2.0' => 1 },
14 uievents => { '2.0' => 1 },
15 mouseevents => { '2.0' => 1},
16 mutationevents => { '2.0' => 1 },
17 htmlevents => { '2.0' => 1 },
18 views => { '2.0' => 1 },
19 # stylesheets => { '2.0' => 1 },
20 # css => { '2.0' => 1 },
21 );
22  
23 sub hasFeature {
24 24 ▶ my($feature,$v) = (lc $_[1], $_[2]);
Subroutine hasFeature: called CC=4 SCAR=13.9
Pod documented
25 exists $features{$feature}
26 24 ▶ ? !defined $v || exists $features{$feature}{$v}
Branch: 1 branch
BranchTrueFalseTotal
exists $features{$feature} ? : 16 8 24
Condition83%5/6
not defined $v or exists $features{$feature}{$v}
l!l&&r!l&&!r
2122
$feature =~ /^(?:stylesheets|css2?)\z/ and require CSS::DOM, "CSS::DOM"->hasFeature(@_[1 .. $#_])
!ll&&!rl&&r
503
MC/DC100%2/2
not defined $v or exists $features{$feature}{$v}
not defined $v exists $features{$feature}{$v}
MC/DC50%1/2
$feature =~ /^(?:stylesheets|css2?)\z/ and require CSS::DOM, "CSS::DOM"->hasFeature(@_[1 .. $#_])
$feature =~ /^(?:stylesheets|css2?)\z/ require CSS::DOM, "CSS::DOM"->hasFeature(@_[1 .. $#_])
Truth table100%3/3
not(A) or B
A= not defined $vB= exists $features{$feature}{$v}
ABresult
1X1
011
000
Truth table66%2/3
A and B
A= $feature =~ /^(?:stylesheets|css2?)\z/B= require CSS::DOM, "CSS::DOM"->hasFeature(@_[1 .. $#_])
ABresult
0X0
100
111
27 : $feature =~ /^(?:stylesheets|css2?)\z/
28 && (require CSS::DOM, CSS::DOM->hasFeature(@_[1..$#_]));
29 }
30  
31 # ~~~ documentation, please!
32 # ~~~ not until I actually decide this should be here.
33 sub add_feature { # feature, version
34 0 ▶ $features{$_[1]}{$_[2]}++;
Subroutine add_feature: not called CC=1 SCAR=6.9
Pod undocumented
35 }
36  
37 29 1
38 __END__
« DOM/Comment.pm ↑ Summary DOM/View.pm »