line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::TableContent::Element; |
2
|
|
|
|
|
|
|
|
3
|
20
|
|
|
20
|
|
7578
|
use Moo; |
|
20
|
|
|
|
|
23
|
|
|
20
|
|
|
|
|
71
|
|
4
|
20
|
|
|
20
|
|
3162
|
use HTML::TableContent::Table; |
|
20
|
|
|
|
|
25
|
|
|
20
|
|
|
|
|
41245
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.17'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my @ATTRIBUTE = |
9
|
|
|
|
|
|
|
qw/class id style colspan rowspan onclick onchange type onkeyup placeholder scope selected value |
10
|
|
|
|
|
|
|
autocomplete for onFocus onBlur href role width height data_toggle data_placement title/; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
around BUILDARGS => sub { |
13
|
|
|
|
|
|
|
my ( $orig, $class, $args ) = @_; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $build = (); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
if ( my $links = delete $args->{links} ) { |
18
|
|
|
|
|
|
|
if ( ref $links eq 'ARRAY' ) { |
19
|
|
|
|
|
|
|
$build->{links} = $links; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
if ( my $concat = delete $args->{truncate} ) { |
24
|
|
|
|
|
|
|
$build->{truncate} = $concat; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
$build->{attributes} = $args; |
28
|
|
|
|
|
|
|
$build->{attribute_list} = \@ATTRIBUTE; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
for my $field ( @ATTRIBUTE, 'html_tag', 'tag') { |
31
|
|
|
|
|
|
|
if ( defined $args->{$field} ) { |
32
|
|
|
|
|
|
|
$build->{$field} = $args->{$field}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
return $class->$orig($build); |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
for my $field (@ATTRIBUTE) { |
40
|
|
|
|
|
|
|
has $field => ( |
41
|
|
|
|
|
|
|
is => 'rw', |
42
|
|
|
|
|
|
|
lazy => 1, |
43
|
|
|
|
|
|
|
trigger => 1, |
44
|
|
|
|
|
|
|
default => q{} |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has [qw/template_attr row_index index data tag/] => ( |
49
|
|
|
|
|
|
|
is => 'rw', |
50
|
|
|
|
|
|
|
clearer => 1, |
51
|
|
|
|
|
|
|
builder => 1, |
52
|
|
|
|
|
|
|
); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
has attributes => ( |
55
|
|
|
|
|
|
|
is => 'rw', |
56
|
|
|
|
|
|
|
default => sub { {} } |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
has [qw/inner_html wrap_html attribute_list truncate/] => ( is => 'rw' ); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
has [qw/children nested links before_element after_element/] => ( |
62
|
|
|
|
|
|
|
is => 'rw', |
63
|
|
|
|
|
|
|
default => sub { [] }, |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
has html_tag => ( |
67
|
|
|
|
|
|
|
is => 'rw', |
68
|
|
|
|
|
|
|
default => 'table', |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub _build_row_index { |
72
|
|
|
|
|
|
|
return |
73
|
|
|
|
|
|
|
defined $_[0]->attributes->{row_index} |
74
|
|
|
|
|
|
|
? delete $_[0]->attributes->{row_index} |
75
|
8631
|
50
|
|
8631
|
|
140017
|
: undef; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub _build_index { |
79
|
|
|
|
|
|
|
return |
80
|
|
|
|
|
|
|
defined $_[0]->attributes->{index} |
81
|
|
|
|
|
|
|
? delete $_[0]->attributes->{index} |
82
|
8631
|
100
|
|
8631
|
|
154006
|
: undef; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub _build_template_attr { |
86
|
|
|
|
|
|
|
return |
87
|
|
|
|
|
|
|
defined $_[0]->attributes->{template_attr} |
88
|
|
|
|
|
|
|
? delete $_[0]->attributes->{template_attr} |
89
|
8631
|
100
|
|
8631
|
|
118442
|
: undef; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub _build_tag { |
93
|
8631
|
|
|
8631
|
|
34309
|
my $caller = caller(); |
94
|
8631
|
|
|
|
|
21826
|
my ($tag) = $caller =~ /.*\:\:(.*)/; |
95
|
8631
|
|
|
|
|
108589
|
return lc $tag; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
0
|
0
|
|
0
|
0
|
0
|
sub has_data { return scalar @{ $_[0]->data } ? 1 : 0; } |
|
0
|
|
|
|
|
0
|
|
99
|
|
|
|
|
|
|
|
100
|
810
|
50
|
|
810
|
0
|
551
|
sub has_children { return scalar @{ $_[0]->children } ? 1 : 0; } |
|
810
|
|
|
|
|
1806
|
|
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
0
|
0
|
0
|
sub count_children { return scalar @{ $_[0]->children }; } |
|
0
|
|
|
|
|
0
|
|
103
|
|
|
|
|
|
|
|
104
|
884
|
100
|
|
884
|
1
|
39033
|
sub has_nested { return scalar @{ $_[0]->nested } ? 1 : 0; } |
|
884
|
|
|
|
|
2766
|
|
105
|
|
|
|
|
|
|
|
106
|
30
|
|
|
30
|
1
|
30
|
sub count_nested { return scalar @{ $_[0]->nested }; } |
|
30
|
|
|
|
|
166
|
|
107
|
|
|
|
|
|
|
|
108
|
71
|
|
|
71
|
1
|
9323
|
sub get_first_nested { return $_[0]->nested->[0]; } |
109
|
|
|
|
|
|
|
|
110
|
14
|
|
|
14
|
1
|
60
|
sub get_nested { return $_[0]->nested->[ $_[1] ]; } |
111
|
|
|
|
|
|
|
|
112
|
11
|
|
|
11
|
1
|
6
|
sub all_nested { return @{ $_[0]->nested }; } |
|
11
|
|
|
|
|
25
|
|
113
|
|
|
|
|
|
|
|
114
|
0
|
0
|
|
0
|
1
|
0
|
sub has_links { return scalar @{ $_[0]->links } ? 1 : 0; } |
|
0
|
|
|
|
|
0
|
|
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
0
|
1
|
0
|
sub count_links { return scalar @{ $_[0]->links }; } |
|
0
|
|
|
|
|
0
|
|
117
|
|
|
|
|
|
|
|
118
|
7
|
|
|
7
|
1
|
23
|
sub get_first_link { return $_[0]->links->[0]; } |
119
|
|
|
|
|
|
|
|
120
|
0
|
|
|
0
|
1
|
0
|
sub get_link { return $_[0]->links->[ $_[1] ]; } |
121
|
|
|
|
|
|
|
|
122
|
0
|
|
|
0
|
1
|
0
|
sub all_links { return @{ $_[0]->links }; } |
|
0
|
|
|
|
|
0
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub add_child { |
125
|
0
|
|
|
0
|
0
|
0
|
my $element = $_[0]->new( $_[1] ); |
126
|
0
|
|
|
|
|
0
|
push @{ $_[0]->children }, $element; |
|
0
|
|
|
|
|
0
|
|
127
|
0
|
|
|
|
|
0
|
return $element; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub add_nested { |
131
|
1
|
|
|
1
|
1
|
30
|
my $table = HTML::TableContent::Table->new( $_[1] ); |
132
|
1
|
|
|
|
|
13
|
push @{ $_[0]->nested }, $table; |
|
1
|
|
|
|
|
7
|
|
133
|
1
|
|
|
|
|
5
|
return $table; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub add_to_nested { |
137
|
1
|
|
|
1
|
0
|
2
|
return push @{ $_[0]->nested }, $_[1]; |
|
1
|
|
|
|
|
10
|
|
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
4295
|
|
|
4295
|
1
|
247273
|
sub text { return join q{ }, @{ $_[0]->data }; } |
|
4295
|
|
|
|
|
12382
|
|
141
|
|
|
|
|
|
|
|
142
|
0
|
|
|
0
|
0
|
0
|
sub truncate_text { return substr($_[0]->text, 0, $_[0]->truncate) . '...'; } |
143
|
|
|
|
|
|
|
|
144
|
1
|
|
|
1
|
0
|
2
|
sub add_text { return push @{ $_[0]->data }, $_[1]; } |
|
1
|
|
|
|
|
7
|
|
145
|
|
|
|
|
|
|
|
146
|
4
|
|
|
4
|
0
|
49
|
sub set_text { $_[0]->data( [ $_[1] ] ); } |
147
|
|
|
|
|
|
|
|
148
|
763
|
|
|
763
|
0
|
799
|
sub lc_text { return lc $_[0]->text; } |
149
|
|
|
|
|
|
|
|
150
|
0
|
|
|
0
|
0
|
0
|
sub ucf_text { return ucfirst $_[0]->text; } |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub add_class { |
153
|
0
|
|
|
0
|
0
|
0
|
my $class = $_[0]->class; |
154
|
0
|
|
|
|
|
0
|
return $_[0]->class( sprintf( '%s %s', $class, $_[1] ) ); |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
sub add_style { |
158
|
1
|
|
|
1
|
0
|
19
|
my $style = $_[0]->style; |
159
|
1
|
|
|
|
|
20
|
return $_[0]->style( sprintf( '%s %s', $style, $_[1] ) ); |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub raw { |
163
|
159
|
|
|
159
|
0
|
762
|
my $args = $_[0]->attributes; |
164
|
|
|
|
|
|
|
|
165
|
159
|
100
|
|
|
|
762
|
if ( $_[0]->has_nested ) { |
166
|
10
|
|
|
|
|
11
|
$args->{nested} = (); |
167
|
10
|
|
|
|
|
30
|
for ( $_[0]->all_nested ) { |
168
|
8
|
|
|
|
|
7
|
push @{ $args->{nested} }, $_->raw; |
|
8
|
|
|
|
|
120
|
|
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
|
172
|
159
|
100
|
|
|
|
114
|
if ( scalar @{ $_[0]->data } ) { |
|
159
|
|
|
|
|
263
|
|
173
|
87
|
|
|
|
|
119
|
$args->{text} = $_[0]->text; |
174
|
87
|
|
|
|
|
102
|
$args->{data} = $_[0]->data; |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
159
|
|
|
|
|
290
|
return $args; |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
sub render { |
181
|
810
|
|
|
810
|
0
|
982
|
my $args = $_[0]->attributes; |
182
|
|
|
|
|
|
|
|
183
|
810
|
|
|
|
|
647
|
my $attr = ''; |
184
|
810
|
|
|
|
|
537
|
foreach my $attribute ( @{ $_[0]->attribute_list } ) { |
|
810
|
|
|
|
|
1116
|
|
185
|
19440
|
100
|
|
|
|
23333
|
if ( my $val = $args->{$attribute} ) { |
186
|
453
|
|
|
|
|
411
|
$attribute =~ s/\_/\-/g; |
187
|
453
|
50
|
|
|
|
855
|
if ( ref $val eq 'ARRAY' ) { |
|
|
50
|
|
|
|
|
|
188
|
|
|
|
|
|
|
$val = sprintf( |
189
|
|
|
|
|
|
|
$val->[0], |
190
|
0
|
|
|
|
|
0
|
map { $_[0]->$_ } @{$val}[ 1 .. scalar @{$val} - 1 ] |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
191
|
|
|
|
|
|
|
); |
192
|
|
|
|
|
|
|
} elsif ( ref $val eq 'CODE' ) { |
193
|
0
|
|
|
|
|
0
|
$val = $val->($_[0]); |
194
|
|
|
|
|
|
|
} |
195
|
453
|
|
|
|
|
923
|
$attr .= sprintf '%s="%s" ', $attribute, $val; |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
810
|
|
|
|
|
7291
|
my $render = $_[0]->_render_element; |
201
|
|
|
|
|
|
|
|
202
|
810
|
100
|
|
|
|
1423
|
if ( my $inner_html = $_[0]->inner_html ) { |
203
|
80
|
|
|
|
|
60
|
my $inner_count = scalar @{$inner_html}; |
|
80
|
|
|
|
|
67
|
|
204
|
80
|
100
|
|
|
|
97
|
if ( $inner_count == 1 ) { |
205
|
64
|
|
|
|
|
124
|
$render = sprintf( $inner_html->[0], $render ); |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
else { |
208
|
|
|
|
|
|
|
$render = sprintf( |
209
|
|
|
|
|
|
|
$inner_html->[0], |
210
|
16
|
|
|
|
|
33
|
map { $_[0]->$_ } @{$inner_html}[ 1 .. $inner_count - 1 ] |
|
32
|
|
|
|
|
114
|
|
|
16
|
|
|
|
|
25
|
|
211
|
|
|
|
|
|
|
); |
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
810
|
50
|
|
|
|
929
|
if ($_[0]->has_children) { |
216
|
0
|
|
|
|
|
0
|
my @elements = map { $_->render } @{ $_[0]->children }; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
217
|
0
|
|
|
|
|
0
|
my $ele_html = sprintf '%s' x @elements, @elements; |
218
|
|
|
|
|
|
|
|
219
|
0
|
|
|
|
|
0
|
$render = sprintf '%s%s', $render, $ele_html; |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
|
222
|
810
|
|
|
|
|
910
|
my $tag = $_[0]->html_tag; |
223
|
810
|
|
|
|
|
1567
|
my $html = sprintf( "<%s %s>%s%s>", $tag, $attr, $render, $tag ); |
224
|
|
|
|
|
|
|
|
225
|
810
|
50
|
|
|
|
1382
|
if ( my $before_element = $_[0]->before_element ) { |
226
|
810
|
|
|
|
|
533
|
for ( @{$before_element} ) { |
|
810
|
|
|
|
|
852
|
|
227
|
0
|
0
|
|
|
|
0
|
my $ren = ref \$_ eq 'SCALAR' ? $_ : $_->render; |
228
|
0
|
|
|
|
|
0
|
$html = sprintf "%s%s", $ren, $html; |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
} |
231
|
|
|
|
|
|
|
|
232
|
810
|
50
|
|
|
|
1249
|
if ( my $after_element = $_[0]->after_element ) { |
233
|
810
|
|
|
|
|
513
|
for ( @{$after_element} ) { |
|
810
|
|
|
|
|
652
|
|
234
|
0
|
0
|
|
|
|
0
|
my $ren = ref \$_ eq 'SCALAR' ? $_ : $_->render; |
235
|
0
|
|
|
|
|
0
|
$html = sprintf "%s%s", $html, $ren; |
236
|
|
|
|
|
|
|
} |
237
|
|
|
|
|
|
|
} |
238
|
|
|
|
|
|
|
|
239
|
810
|
50
|
|
|
|
1211
|
if ( my $wrap_html = $_[0]->wrap_html ) { |
240
|
0
|
|
|
|
|
0
|
my $wrap_count = scalar @{$wrap_html}; |
|
0
|
|
|
|
|
0
|
|
241
|
0
|
0
|
|
|
|
0
|
if ( $wrap_count == 1 ) { |
242
|
0
|
|
|
|
|
0
|
$html = sprintf( $wrap_html->[0], $html ); |
243
|
|
|
|
|
|
|
} |
244
|
|
|
|
|
|
|
else { |
245
|
|
|
|
|
|
|
$html = sprintf( |
246
|
|
|
|
|
|
|
$wrap_html->[0], |
247
|
0
|
|
|
|
|
0
|
map { $_[0]->$_ } @{$wrap_html}[ 1 .. $wrap_html - 1 ] |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
248
|
|
|
|
|
|
|
); |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
|
252
|
810
|
|
|
|
|
935
|
return $_[0]->tidy_html($html); |
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
sub _render_element { |
256
|
616
|
|
|
616
|
|
800
|
return $_[0]->_render_element_text($_[0]->text); |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
sub _render_element_text { |
260
|
616
|
50
|
|
616
|
|
1084
|
return defined $_[0]->truncate ? $_[0]->truncate_text($_[0]->text) : $_[0]->text; |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
|
263
|
2616
|
|
|
2616
|
|
46121
|
sub _trigger_class { return $_[0]->attributes->{class} = $_[1]; } |
264
|
|
|
|
|
|
|
|
265
|
976
|
|
|
976
|
|
21793
|
sub _trigger_id { return $_[0]->attributes->{id} = $_[1]; } |
266
|
|
|
|
|
|
|
|
267
|
18
|
|
|
18
|
|
402
|
sub _trigger_style { return $_[0]->attributes->{style} = $_[1]; } |
268
|
|
|
|
|
|
|
|
269
|
0
|
|
|
0
|
|
0
|
sub _trigger_colspan { return $_[0]->attributes->{colspan} = $_[1]; } |
270
|
|
|
|
|
|
|
|
271
|
0
|
|
|
0
|
|
0
|
sub _trigger_rowspan { return $_[0]->attributes->{rowspan} = $_[1]; } |
272
|
|
|
|
|
|
|
|
273
|
0
|
|
|
0
|
|
0
|
sub _trigger_onclick { return $_[0]->attributes->{onclick} = $_[1]; } |
274
|
|
|
|
|
|
|
|
275
|
0
|
|
|
0
|
|
0
|
sub _trigger_onchange { return $_[0]->attributes->{onchange} = $_[1]; } |
276
|
|
|
|
|
|
|
|
277
|
0
|
|
|
0
|
|
0
|
sub _trigger_type { return $_[0]->attributes->{type} = $_[1]; } |
278
|
|
|
|
|
|
|
|
279
|
0
|
|
|
0
|
|
0
|
sub _trigger_value { return $_[0]->attributes->{value} = $_[1]; } |
280
|
|
|
|
|
|
|
|
281
|
0
|
|
|
0
|
|
0
|
sub _trigger_scope { return $_[0]->attributes->{scope} = $_[1]; } |
282
|
|
|
|
|
|
|
|
283
|
0
|
|
|
0
|
|
0
|
sub _trigger_onkeyup { return $_[0]->attributes->{onkeyup} = $_[1]; } |
284
|
|
|
|
|
|
|
|
285
|
0
|
|
|
0
|
|
0
|
sub _trigger_placeholder { return $_[0]->attributes->{placeholder} = $_[1]; } |
286
|
|
|
|
|
|
|
|
287
|
0
|
|
|
0
|
|
0
|
sub _trigger_onFocus { return $_[0]->attributes->{onFocus} = $_[1]; } |
288
|
|
|
|
|
|
|
|
289
|
0
|
|
|
0
|
|
0
|
sub _trigger_onBlur { return $_[0]->attributes->{onBlur} = $_[1]; } |
290
|
|
|
|
|
|
|
|
291
|
0
|
|
|
0
|
|
0
|
sub _trigger_role { return $_[0]->attributes->{role} = $_[1]; } |
292
|
|
|
|
|
|
|
|
293
|
0
|
|
|
0
|
|
0
|
sub _trigger_href { return $_[0]->attributes->{href} = $_[1]; } |
294
|
|
|
|
|
|
|
|
295
|
0
|
|
|
0
|
|
0
|
sub _trigger_width { return $_[0]->attributes->{width} = $_[1]; } |
296
|
|
|
|
|
|
|
|
297
|
0
|
|
|
0
|
|
0
|
sub _trigger_height { return $_[0]->attributes->{height} = $_[1]; } |
298
|
|
|
|
|
|
|
|
299
|
0
|
|
|
0
|
|
0
|
sub _trigger_data_toggle { return $_[0]->attributes->{data_toggle} = $_[1]; } |
300
|
|
|
|
|
|
|
|
301
|
0
|
|
|
0
|
|
0
|
sub _trigger_data_placement { return $_[0]->attributes->{data_placement} = $_[1]; } |
302
|
|
|
|
|
|
|
|
303
|
0
|
|
|
0
|
|
0
|
sub _trigger_title { return $_[0]->attributes->{title} = $_[1]; } |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
sub _trigger_template_attr { |
306
|
0
|
|
|
0
|
|
0
|
return $_[0]->attributes->{template_attr} = $_[1]; |
307
|
|
|
|
|
|
|
} |
308
|
|
|
|
|
|
|
|
309
|
0
|
|
|
0
|
|
0
|
sub _trigger_selected { return $_[0]->attributes->{selected} = $_[1]; } |
310
|
|
|
|
|
|
|
|
311
|
0
|
|
|
0
|
|
0
|
sub _trigger_autocomplete { return $_[0]->attributes->{autocomplete} = $_[1]; } |
312
|
|
|
|
|
|
|
|
313
|
0
|
|
|
0
|
|
0
|
sub _trigger_for { return $_[0]->attributes->{for} = $_[1]; } |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
sub _build_data { |
316
|
8631
|
|
|
8631
|
|
29681
|
my $data = delete $_[0]->attributes->{data}; |
317
|
8631
|
|
|
|
|
8958
|
my $text = delete $_[0]->attributes->{text}; |
318
|
|
|
|
|
|
|
|
319
|
8631
|
100
|
|
|
|
13274
|
if ( defined $text ) { |
320
|
3715
|
|
|
|
|
2992
|
push @{$data}, $text; |
|
3715
|
|
|
|
|
6229
|
|
321
|
|
|
|
|
|
|
} |
322
|
|
|
|
|
|
|
|
323
|
8631
|
50
|
100
|
|
|
12120
|
return $data if defined $data && scalar @{$data}; |
|
3715
|
|
|
|
|
48857
|
|
324
|
4916
|
|
|
|
|
59909
|
return []; |
325
|
|
|
|
|
|
|
} |
326
|
|
|
|
|
|
|
|
327
|
0
|
0
|
|
0
|
0
|
0
|
sub has_id { return length $_[0]->id ? 1 : 0; } |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
sub tidy_html { |
330
|
810
|
|
|
810
|
0
|
3142
|
$_[1] =~ s/\s+>/>/g; |
331
|
810
|
|
|
|
|
2313
|
return $_[1]; |
332
|
|
|
|
|
|
|
} |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
1; |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
__END__ |