File Coverage

blib/lib/Rose/HTML/Label.pm
Criterion Covered Total %
statement 16 17 94.1
branch 2 4 50.0
condition n/a
subroutine 6 7 85.7
pod 3 4 75.0
total 27 32 84.3


line stmt bran cond sub pod time code
1              
2             use strict;
3 36     36   1540  
  36         256  
  36         1064  
4             use Rose::HTML::Text;
5 36     36   10643  
  36         115  
  36         251  
6             use base 'Rose::HTML::Object';
7 36     36   208  
  36         62  
  36         8790  
8             our $VERSION = '0.606';
9              
10             __PACKAGE__->add_valid_html_attrs
11             (
12             'for', # IDREF #IMPLIED -- matches field ID value --
13             'accesskey', # %Character; #IMPLIED -- accessibility key character --
14             'onfocus', # %Script; #IMPLIED -- the element got the focus --
15             'onblur', # %Script; #IMPLIED -- the element lost the focus --
16             );
17              
18              
19 0     0 1 0 {
20 790     790 1 2635 my($self) = shift;
21 48     48 1 186 $self->children(map { UNIVERSAL::isa($_, 'Rose::HTML::Object') ? $_ :
22             Rose::HTML::Text->new(html => $_) } @_) if(@_);
23             return join('', map { $_->html } $self->children)
24             }
25 416     416 0 1753  
26 416 50       935 1;
  416 50       1904  
27              
28 416         850  
  416         782  
29             =head1 NAME
30              
31             Rose::HTML::Label - Object representation of the "label" HTML tag.
32              
33             =head1 SYNOPSIS
34              
35             my $label = Rose::HTML::Label->new(for => 'name',
36             contents => 'Name');
37              
38             # <label for="name">Name</label>
39             print $i->html;
40              
41             $i->accesskey('n');
42              
43             # <label accesskey="n" for="name">Name</label>
44             print $i->xhtml;
45             ...
46              
47             =head1 DESCRIPTION
48              
49             L<Rose::HTML::Label> is an object representation of the E<lt>labelE<gt> HTML tag. Yes, there really is a E<lt>labelE<gt> tag in both HTML 4.01 and XHTML 1.0. Look it up.
50              
51             This class inherits from, and follows the conventions of, L<Rose::HTML::Object>. Inherited methods that are not overridden will not be documented a second time here. See the L<Rose::HTML::Object> documentation for more information.
52              
53             =head1 HTML ATTRIBUTES
54              
55             Valid attributes:
56              
57             accesskey
58             class
59             dir
60             for
61             id
62             lang
63             onblur
64             onclick
65             ondblclick
66             onfocus
67             onkeydown
68             onkeypress
69             onkeyup
70             onmousedown
71             onmousemove
72             onmouseout
73             onmouseover
74             onmouseup
75             style
76             title
77             xml:lang
78              
79             =head1 AUTHOR
80              
81             John C. Siracusa (siracusa@gmail.com)
82              
83             =head1 LICENSE
84              
85             Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.