File Coverage

lib/HTML/Object/DOM/Element/FieldSet.pm
Criterion Covered Total %
statement 22 38 57.8
branch 0 4 0.0
condition n/a
subroutine 8 12 66.6
pod 3 3 100.0
total 33 57 57.8


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## HTML Object - ~/lib/HTML/Object/DOM/Element/FieldSet.pm
3             ## Version v0.2.0
4             ## Copyright(c) 2021 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2021/12/23
7             ## Modified 2022/09/18
8             ## All rights reserved
9             ##
10             ##
11             ## This program is free software; you can redistribute it and/or modify it
12             ## under the same terms as Perl itself.
13             ##----------------------------------------------------------------------------
14             package HTML::Object::DOM::Element::FieldSet;
15             BEGIN
16             {
17 1     1   1028 use strict;
  1         3  
  1         29  
18 1     1   5 use warnings;
  1         13  
  1         29  
19 1     1   5 use parent qw( HTML::Object::DOM::Element );
  1         9  
  1         4  
20 1     1   68 use vars qw( $VERSION );
  1         2  
  1         49  
21 1     1   7 use HTML::Object::DOM::Element::Shared qw( :fieldset );
  1         4  
  1         184  
22 1     1   30 our $VERSION = 'v0.2.0';
23             };
24              
25 1     1   7 use strict;
  1         2  
  1         35  
26 1     1   15 use warnings;
  1         7  
  1         333  
27              
28             sub init
29             {
30 0     0 1   my $self = shift( @_ );
31 0           $self->{_init_strict_use_sub} = 1;
32 0 0         $self->SUPER::init( @_ ) || return( $self->pass_error );
33 0 0         $self->{tag} = 'audio' if( !CORE::length( "$self->{tag}" ) );
34 0           $self->{type} = 'fieldset';
35 0           return( $self );
36             }
37              
38             # Note: method checkValidity inherited
39              
40             # Note: property disabled inherited
41              
42             # Note: property read-only
43             sub elements
44             {
45 0     0 1   my $self = shift( @_ );
46 0           my $children = $self->children;
47             # my $form_elements = $self->new_array( [qw( button datalist fieldset input label legend meter optgroup option output progress select textarea )] );
48             # <https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/elements#value>
49 0           my $form_elements = $self->new_array( [qw( button fieldset input object output select textarea )] );
50 0           my $list = $form_elements->as_hash;
51 0     0     my $results = $children->grep(sub{ exists( $form_elements->{ $_->tag } ) });
  0            
52 0           my $col = $self->new_collection;
53 0           $col->push( $results->list );
54 0           return( $col );
55             }
56              
57             # Note: property read-only form inherited
58              
59             # Note: property name inherited
60              
61             # Note: method reportValidity inherited
62              
63             # Note: method setCustomValidity inherited
64              
65             # Note: property read-only different from the attribute type
66 0     0 1   sub type : lvalue { return( shift->_set_get_scalar_as_object( 'type' ) ); }
67              
68             # Note: property validationMessage inherited
69              
70             # Note: property validity inherited
71              
72             # Note: property willValidate inherited
73              
74             1;
75             # NOTE: POD
76             __END__
77              
78             =encoding utf-8
79              
80             =head1 NAME
81              
82             HTML::Object::DOM::Element::FieldSet - HTML Object DOM Field Set Class
83              
84             =head1 SYNOPSIS
85              
86             use HTML::Object::DOM::Element::FieldSet;
87             my $set = HTML::Object::DOM::Element::FieldSet->new ||
88             die( HTML::Object::DOM::Element::FieldSet->error, "\n" );
89              
90             =head1 VERSION
91              
92             v0.2.0
93              
94             =head1 DESCRIPTION
95              
96             This interface provides special properties and methods (beyond the regular L<HTML::Object::Element> interface it also has available to it by inheritance) for manipulating the layout and presentation of C<<fieldset>> elements.
97              
98             =head1 INHERITANCE
99              
100             +-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ +--------------------------------------+
101             | HTML::Object::Element | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Node | --> | HTML::Object::DOM::Element | --> | HTML::Object::DOM::Element::FieldSet |
102             +-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ +--------------------------------------+
103              
104             =head1 PROPERTIES
105              
106             Inherits properties from its parent L<HTML::Object::DOM::Element>
107              
108             =head2 disabled
109              
110             A boolean value reflecting the disabled HTML attribute, indicating whether the user can interact with the control.
111              
112             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLFieldSetElement/disabled>
113              
114             =head2 elements
115              
116             Read-only.
117              
118             The L<form elements|https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/elements> belonging to this field set. It returns a L<collection object|HTML::Object::DOM::Collection> of such elements found inside the fieldset.
119              
120             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLFieldSetElement/elements>, see this docu also for L<list of form elements|https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#see_also>
121              
122             =head2 form
123              
124             Read-only.
125              
126             An L<HTML::Object::DOM::Element::Form> object referencing the containing form element, if this element is in a form, otherwise it returns C<undef>.
127              
128             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLFieldSetElement/form>
129              
130             =head2 name
131              
132             A string reflecting the name HTML attribute, containing the name of the field set. This can be used when accessing the field set in JavaScript. It is not part of the data which is sent to the server.
133              
134             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLFieldSetElement/name>
135              
136             =head2 type
137              
138             Read-only.
139              
140             Returns the string C<fieldset> as a L<scalar object|Module::Generic::Scalar>.
141              
142             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLFieldSetElement/type>
143              
144             =head2 validationMessage
145              
146             A string representing a localized message that describes the validation constraints that the element does not satisfy (if any). This is the empty string if the element is not a candidate for constraint validation (willValidate is false), or it satisfies its constraints.
147              
148             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLFieldSetElement/validationMessage>
149              
150             =head2 validity
151              
152             A L<HTML::Object::DOM::ValidityState> representing the validity states that this element is in.
153              
154             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLFieldSetElement/validity>
155              
156             =head2 willValidate
157              
158             A boolean value false, because <fieldset> objects are never candidates for constraint validation.
159              
160             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLFieldSetElement/willValidate>
161              
162             =head1 METHODS
163              
164             Inherits methods from its parent L<HTML::Object::DOM::Element>
165              
166             =head2 checkValidity
167              
168             Set or get a boolean value, because under perl it does not do any checks.
169              
170             Normally, under JavaScript, this always returns true because <fieldset> objects are never candidates for constraint validation.
171              
172             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLFieldSetElement/checkValidity>
173              
174             =head2 reportValidity
175              
176             Set or get a boolean value, because under perl it does not do any checks.
177              
178             Normally, under JavaScript, this always returns true because <fieldset> objects are never candidates for constraint validation.
179              
180             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLFieldSetElement/reportValidity>
181              
182             =head2 setCustomValidity
183              
184             Sets a custom validity message for the field set. If this message is not the empty string, then the field set is suffering from a custom validity error, and does not validate.
185              
186             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLFieldSetElement/setCustomValidity>
187              
188             =head1 AUTHOR
189              
190             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
191              
192             =head1 SEE ALSO
193              
194             L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLFieldSetElement>, L<Mozilla documentation on fieldset element|https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset>
195              
196             =head1 COPYRIGHT & LICENSE
197              
198             Copyright(c) 2021 DEGUEST Pte. Ltd.
199              
200             All rights reserved
201              
202             This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
203              
204             =cut