File Coverage

blib/lib/Mojo/Collection/Role/Extra.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 17 17 100.0


line stmt bran cond sub pod time code
1             package Mojo::Collection::Role::Extra ;
2             $Mojo::Collection::Role::Extra::VERSION = '0.014';
3 2     2   2212 use Role::Tiny;
  2         4  
  2         15  
4              
5             sub common {
6 5     5 1 1965 my $c = shift;
7 5         17 my $size = $c->size;
8 5         29 my $current_node = $c->first;
9 5         27 my $parent_node;
10             my $enclosed;
11 5         7 do {
12 8         34 $parent_node = $current_node->parent;
13 8     16   350 $enclosed = $c->grep(sub { $parent_node->is_ancestor_to($_) } );
  16         94  
14 8         91 $current_node = $parent_node;
15             } while ($size > $enclosed->size);
16              
17 5         37 return $parent_node;
18              
19             }
20              
21             1; # Magic true value
22             # ABSTRACT: provides methods for use with Mojo::DOM::Role::Analyzer
23              
24             __END__