File Coverage

blib/lib/HTML/DOM/Implementation.pm
Criterion Covered Total %
statement 8 9 88.8
branch 2 2 100.0
condition 4 6 66.6
subroutine 3 4 75.0
pod 1 2 50.0
total 18 23 78.2


line stmt bran cond sub pod time code
1             package HTML::DOM::Implementation;
2              
3 29     29   12651 use strict;
  29         25  
  29         646  
4 29     29   78 use warnings;
  29         25  
  29         5344  
5              
6             our $VERSION = '0.056';
7              
8             our $it = bless do{\my$x};
9              
10             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     24 1 56817 my($feature,$v) = (lc $_[1], $_[2]);
25             exists $features{$feature}
26 24 100 66     150 ? !defined $v || exists $features{$feature}{$v}
      66        
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     0 0   $features{$_[1]}{$_[2]}++;
35             }
36              
37             1
38             __END__