blib/lib/HTML/Object/DOM/Element/FieldSet.pm untested

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