line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SyForm::CommonRole::GlobalHTML; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
7
|
|
|
7
|
|
4820
|
$SyForm::CommonRole::GlobalHTML::AUTHORITY = 'cpan:GETTY'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
# ABSTRACT: Standard role for objects with HTML global attributes |
6
|
|
|
|
|
|
|
$SyForm::CommonRole::GlobalHTML::VERSION = '0.103'; |
7
|
7
|
|
|
7
|
|
101
|
use Moo::Role; |
|
7
|
|
|
|
|
80
|
|
|
7
|
|
|
|
|
114
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @attributes = qw( |
10
|
|
|
|
|
|
|
class |
11
|
|
|
|
|
|
|
accesskey |
12
|
|
|
|
|
|
|
contenteditable |
13
|
|
|
|
|
|
|
contextmenu |
14
|
|
|
|
|
|
|
dir |
15
|
|
|
|
|
|
|
draggable |
16
|
|
|
|
|
|
|
dropzone |
17
|
|
|
|
|
|
|
hidden |
18
|
|
|
|
|
|
|
lang |
19
|
|
|
|
|
|
|
spellcheck |
20
|
|
|
|
|
|
|
style |
21
|
|
|
|
|
|
|
tabindex |
22
|
|
|
|
|
|
|
title |
23
|
|
|
|
|
|
|
translate |
24
|
|
|
|
|
|
|
id |
25
|
|
|
|
|
|
|
name |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
for my $attribute (@attributes) { |
29
|
|
|
|
|
|
|
has $attribute => ( |
30
|
|
|
|
|
|
|
is => 'ro', |
31
|
|
|
|
|
|
|
predicate => 1, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has data => ( |
36
|
|
|
|
|
|
|
is => 'ro', |
37
|
|
|
|
|
|
|
predicate => 1, |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has data_attributes => ( |
41
|
|
|
|
|
|
|
is => 'lazy', |
42
|
|
|
|
|
|
|
init_arg => undef, |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _build_data_attributes { |
46
|
39
|
|
|
39
|
|
289
|
my ( $self ) = @_; |
47
|
39
|
100
|
|
|
|
226
|
return {} unless $self->has_data; |
48
|
2
|
|
|
|
|
7
|
my %data_attributes; |
49
|
2
|
|
|
|
|
5
|
for my $key (sort { $a cmp $b } keys %{$self->data}) { |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
12
|
|
50
|
4
|
|
|
|
|
11
|
my $value = $self->data->{$key}; |
51
|
4
|
|
|
|
|
11
|
$key =~ s/_/-/g; |
52
|
4
|
|
|
|
|
12
|
$data_attributes{'data-'.$key} = $value; |
53
|
|
|
|
|
|
|
} |
54
|
2
|
|
|
|
|
16
|
return { %data_attributes }; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=pod |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 NAME |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
SyForm::CommonRole::GlobalHTML - Standard role for objects with HTML global attributes |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 VERSION |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
version 0.103 |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 AUTHOR |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Torsten Raudssus <torsten@raudss.us> |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Torsten Raudssus. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
80
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |