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.013';
3 2     2   2755 use Role::Tiny;
  2         4  
  2         19  
4              
5             sub common {
6 6     6 1 3086 my $c = shift;
7 6         20 my $size = $c->size;
8 6         46 my $current_node = $c->first;
9 6         37 my $parent_node;
10             my $enclosed;
11 6         13 do {
12 11         56 $parent_node = $current_node->parent;
13 11     25   559 $enclosed = $c->grep(sub { $parent_node->is_ancestor_to($_) } );
  25         179  
14 11         112 $current_node = $parent_node;
15             } while ($size > $enclosed->size);
16              
17 6         53 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__