File Coverage

lib/HTML/Object/DOM/Element/Shared.pm
Criterion Covered Total %
statement 58 129 44.9
branch 6 20 30.0
condition 2 10 20.0
subroutine 29 82 35.3
pod 60 75 80.0
total 155 316 49.0


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## HTML Object - ~/lib/HTML/Object/DOM/Element/Shared.pm
3             ## Version v0.2.0
4             ## Copyright(c) 2021 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2021/12/25
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::Shared;
15             BEGIN
16             {
17 21     21   143 use strict;
  21         51  
  21         682  
18 21     21   117 use warnings;
  21         41  
  21         607  
19 21     21   114 use vars qw( @EXPORT_OK %EXPORT_TAGS $VERSION );
  21         42  
  21         1237  
20 21     21   381 use Exporter qw( import );
  21         50  
  21         7816  
21 21     21   388 our @EXPORT_OK = qw(
22             accept accessKey align allowdirs alt autocapitalize autocomplete autofocus checked checkValidity compact crossOrigin currentSrc defaultChecked defaultValue dirName disabled download files form formAction formEnctype formMethod formNoValidate formTarget hash height host hostname href hreflang indeterminate inputmode labels list max maxLength min minLength multiple name origin password pathname pattern placeholder port protocol readOnly referrerPolicy rel relList reportValidity required selectionDirection selectionEnd selectionStart search setCustomValidity size src step target type useMap username value validationMessage validity valueAsDate valueAsNumber webkitdirectory webkitEntries willValidate width
23             );
24 21         1876 our %EXPORT_TAGS = (
25             anchor => [qw( download hash host hostname href hreflang origin password pathname port protocol referrerPolicy rel relList search target username )],
26             area => [qw( accessKey alt download hash host hostname href hreflang origin password pathname port protocol referrerPolicy rel relList search target username )],
27             base => [qw( href target )],
28             button => [qw(
29             form formAction formEnctype formMethod formNoValidate formTarget
30             accessKey autofocus disabled form labels name type validationMessage validity value willValidate
31             )],
32             canvas => [qw( height width )],
33             caption => [qw( align )],
34             dir => [qw( compact )],
35             div => [qw( align )],
36             dl => [qw( compact )],
37             embed => [qw( align height name src width )],
38             fieldset => [qw( disabled checkValidity form name reportValidity setCustomValidity validationMessage validity willValidate )],
39             form => [qw(
40             accept autocapitalize autocomplete name
41            
42             checkValidity reportValidity
43             )],
44             heading => [qw( align )],
45             hr => [qw( align size width )],
46             iframe => [qw( align height name referrerPolicy src width )],
47             img => [qw( alt crossOrigin currentSrc height referrerPolicy src useMap width )],
48             input => [qw(
49             accept accessKey align allowdirs alt autocapitalize autocomplete autofocus checked
50             defaultChecked defaultValue dirName disabled files form
51             formAction formEnctype formMethod formNoValidate formTarget height indeterminate
52             inputmode labels list max maxLength min minLength multiple name pattern placeholder
53             readOnly required selectionDirection selectionEnd selectionStart size src step
54             type useMap validationMessage validity value valueAsDate valueAsNumber
55             webkitEntries webkitdirectory width willValidate
56             )],
57             label => [qw( form )],
58             legend => [qw( accessKey align form )],
59             li => [qw( type value )],
60             'link' => [qw( crossOrigin disabled href hreflang referrerPolicy rel relList type )],
61             'map' => [qw( name )],
62             marquee => [qw( height width )],
63             media => [qw( crossOrigin currentSrc src )],
64             menu => [qw( compact type )],
65             meter => [qw( labels max min value )],
66             object => [qw( align checkValidity height name setCustomValidity type useMap validity validationMessage width willValidate )],
67             ol => [qw( compact type )],
68             optgroup => [qw( disabled )],
69             option => [qw( disabled form )],
70             output => [qw( checkValidity form labels setCustomValidity type validity validationMessage value willValidate )],
71             paragraph => [qw( align )],
72             param => [qw( name type value )],
73             pre => [qw( width )],
74             progress => [qw( labels value )],
75             script => [qw( crossOrigin src referrerPolicy type )],
76             'select' => [qw( checkValidity disabled form labels name reportValidity required setCustomValidity type validationMessage validity value willValidate )],
77             slot => [qw( name )],
78             source => [qw( src type )],
79             style => [qw( disabled type )],
80             table => [qw( align width )],
81             tablecaption => [qw( align )],
82             tablecell => [qw( align height width )],
83             tablecol => [qw( align width )],
84             tablerow => [qw( align )],
85             tablesection => [qw( align )],
86             track => [qw( src )],
87             ulist => [qw( compact type )],
88             video => [qw( height width )],
89             );
90 21         351 $EXPORT_TAGS{all} = [@EXPORT_OK];
91 21         554 our $VERSION = 'v0.2.0';
92             };
93              
94 21     21   143 use strict;
  21         277  
  21         449  
95 21     21   110 use warnings;
  21         46  
  21         41510  
96              
97             # Note: property for input
98 0     0 1 0 sub accept : lvalue { return( shift->_set_get_property( 'accept', @_ ) ); }
99              
100             # Note: property for input
101 0     0 1 0 sub accessKey : lvalue { return( shift->_set_get_property( 'accesskey', @_ ) ); }
102              
103             # Note: property for embed
104 0     0 0 0 sub align : lvalue { return( shift->_set_get_property( 'align', @_ ) ); }
105              
106             # Note: property for input
107 0     0 1 0 sub allowdirs : lvalue { return( shift->_set_get_boolean( 'allowdirs', @_ ) ); }
108              
109             # Note: property for img, input
110 0     0 1 0 sub alt : lvalue { return( shift->_set_get_property( 'alt', @_ ) ); }
111              
112             # Note: property for input
113 0     0 1 0 sub autocapitalize : lvalue { return( shift->_set_get_property( 'autocapitalize', @_ ) ); }
114              
115             # Note: property for input
116 0     0 1 0 sub autocomplete : lvalue { return( shift->_set_get_property( 'autocomplete', @_ ) ); }
117              
118             # Note: property for input
119 0     0 1 0 sub autofocus : lvalue { return( shift->_set_get_property( { attribute => 'autofocus', is_boolean => 1 }, @_ ) ); }
120              
121             # Note: property boolean for input
122 0     0 1 0 sub checked : lvalue { return( shift->_set_get_property( { attribute => 'checked', is_boolean => 1 }, @_ ) ); }
123              
124             # Note: method
125 0     0 1 0 sub checkValidity { return( shift->_set_get_boolean( 'checkValidity', @_ ) ); }
126              
127             # Note: property
128 0     0 0 0 sub compact : lvalue { return( shift->_set_get_property( { attribute => 'compact', is_boolean => 1 }, @_ ) ); }
129              
130             # Note: property
131 0     0 1 0 sub crossOrigin : lvalue { return( shift->_set_get_property( 'crossorigin', @_ ) ); }
132              
133             # Note: property
134 0     0 0 0 sub currentSrc : lvalue { return( shift->_set_get_property( 'currentsrc', @_ ) ); }
135              
136             # Note: property boolean for input
137 0     0 1 0 sub defaultChecked : lvalue { return( shift->_set_get_property( { attribute => 'defaultchecked', is_boolean => 1 }, @_ ) ); }
138              
139             # Note: property for input
140 0     0 0 0 sub defaultValue : lvalue { return( shift->_set_get_property( 'value', @_ ) ); }
141              
142             # Note: property for input
143 0     0 1 0 sub dirName { return( shift->_set_get_scalar_as_object( 'dirName', @_ ) ); }
144              
145             # Note: property for input
146 1     1 1 1474 sub disabled : lvalue { return( shift->_set_get_property( { attribute => 'disabled', is_boolean => 1 }, @_ ) ); }
147              
148             # Note: property for anchor, area
149 2     2 0 229 sub download : lvalue { return( shift->_set_get_property( 'download', @_ ) ); }
150              
151             # Note: property for input
152 0     0 1 0 sub files { return( shift->_set_get_object( 'files', 'HTML::Object::DOM::FileList' ) ); }
153              
154             # Note: property read-only
155             sub form
156             {
157 1     1 1 1324 my $self = shift( @_ );
158             # If the element has a 'form' attribute containing the form it, we use it to find the specific form, otherwise we search for the parent form
159 1         4 my $id = $self->attr( 'form' );
160 1 50 33     634 if( defined( $id ) && CORE::length( "$id" ) )
161             {
162 0         0 my $root = $self->root;
163 0 0       0 return if( !defined( $root ) );
164             # my $form = $root->getElementById( $id );
165 0         0 my $forms = $root->look_down( _tag => 'form', id => $id );
166 0         0 return( $forms->first );
167             }
168             else
169             {
170 1         9 return( $self->_get_parent_form );
171             }
172             }
173              
174             # Note: property for input
175 0     0 1 0 sub formAction : lvalue { return( shift->_set_get_form_attribute( 'action', @_ ) ); }
176              
177             # Note: property for input
178 0     0 1 0 sub formEnctype : lvalue { return( shift->_set_get_form_attribute( 'enctype', @_ ) ); }
179              
180             # Note: property for input
181 0     0 1 0 sub formMethod : lvalue { return( shift->_set_get_form_attribute( 'method', @_ ) ); }
182              
183             # Note: property for input
184 0     0 1 0 sub formNoValidate : lvalue { return( shift->_set_get_form_attribute( 'novalidate', @_ ) ); }
185              
186             # Note: property for input
187 0     0 1 0 sub formTarget : lvalue { return( shift->_set_get_form_attribute( 'target', @_ ) ); }
188              
189             # Note: property for anchor
190 4     4 1 2161 sub hash : lvalue { return( shift->_set_get_uri_property( 'hash', @_ ) ); }
191              
192             # Note: property for input
193 0     0 1 0 sub height : lvalue { return( shift->_set_get_property( 'height', @_ ) ); }
194              
195             # Note: property for anchor
196 2     2 1 695 sub host : lvalue { return( shift->_set_get_uri_property( 'host', @_ ) ); }
197              
198             # Note: property for anchor
199 3     3 1 1198 sub hostname : lvalue { return( shift->_set_get_uri_property( 'hostname', @_ ) ); }
200              
201             # Note: property for anchor
202 32     32 1 6312 sub href : lvalue { return( shift->_set_get_property( { attribute => 'href', is_uri => 1 }, @_ ) ); }
203              
204             # Note: property for anchor
205 2     2 0 581 sub hreflang : lvalue { return( shift->_set_get_property( 'hreflang', @_ ) ); }
206              
207             # Note: property boolean for input
208 0     0 1 0 sub indeterminate : lvalue { return( shift->_set_get_property( { attribute => 'indeterminate', is_boolean => 1 }, @_ ) ); }
209              
210             #Note: property for input
211 0     0 1 0 sub inputmode : lvalue { return( shift->_set_get_property( 'inputmode', @_ ) ); }
212              
213             # Note: property
214             sub labels
215             {
216 0     0 1 0 my $self = shift( @_ );
217 0         0 my $results = $self->new_array;
218             # No need to go further really
219 0         0 my $id = $self->attributes->get( 'id' );
220 0 0 0     0 return( $results ) if( !defined( $id ) || !length( $id ) );
221 0   0     0 my $root = $self->root || return( $results );
222 0         0 $results = $root->look_down( _tag => 'label', 'for' => $id );
223 0         0 return( $self->new_nodelist( $results ) );
224             }
225              
226             # Note: property for input; an element object pointing to <datalist>
227             sub list
228             {
229 0     0 1 0 my $self = shift( @_ );
230 0 0       0 if( @_ )
231             {
232 0         0 return( $self->_set_get_object_without_init( 'list', 'HTML::Object::DOM::Element', @_ ) );
233             }
234             else
235             {
236 0 0       0 return( $self->{list} ) if( ref( $self->{list} ) );
237 0         0 my $root = $self->root;
238 0         0 my $id = $self->attr( 'list' );
239 0 0       0 return( $self->new_null ) if( !defined( $id ) );
240 0         0 my $elem = $root->look_down( _tag => 'datalist', id => $id );
241 0         0 return( $self->{list} = $elem );
242             }
243             }
244              
245             # Note: property for input
246 0     0 1 0 sub max : lvalue { return( shift->_set_get_property( 'max', @_ ) ); }
247              
248             # Note: property for input
249 0     0 1 0 sub maxLength : lvalue { return( shift->_set_get_property( 'maxlength', @_ ) ); }
250              
251             # Note: property for input
252 0     0 1 0 sub min : lvalue { return( shift->_set_get_property( 'min', @_ ) ); }
253              
254             # Note: property for input
255 0     0 1 0 sub minLength : lvalue { return( shift->_set_get_property( 'minlength', @_ ) ); }
256              
257             # Note: property boolean for input
258 0     0 1 0 sub multiple : lvalue { return( shift->_set_get_property( { attribute => 'multiple', is_boolean => 1 }, @_ ) ); }
259              
260             # Note: property for input
261 3     3 1 2160 sub name : lvalue { return( shift->_set_get_property( 'name', @_ ) ); }
262              
263             # Note: property for anchor
264             sub origin
265             {
266 3     3 0 2573 my $self = shift( @_ );
267 3         14 my $uri = $self->_set_get_anchor_uri;
268             # We use ref() and not ->isa on purpose, because URI::https (for example) is a subclass of URI::_generic
269             # so ->isa( 'URI::_generic' ) will always return true
270 3 50       14 return if( ref( $uri ) eq 'URI::_generic' );
271 3 50       15 return if( !$uri->host );
272             # The web standard is to return a hostname without its port if it is a standard port, even if it was specified
273             # e.g. https://example.org:443 -> https://example.org
274             # return( $uri->canonical );
275             # I need a way to remove the port if it is standard. URI->canonical gives us that, but also includes the path, which we do not want
276             # and we do not want a trailing '/', which canonical adds
277 3         154 my $origin = URI->new( join( '', $uri->scheme, '://', $uri->host_port ) )->canonical;
278             # substr( $origin, -1, 1, '' ) if( substr( $origin, -1, 1 ) eq '/' );
279 3 50       1125 $origin->path( substr( $origin->path, 0, -1 ) ) if( substr( $origin->path, -1, 1 ) eq '/' );
280 3         129 return( $origin );
281             }
282              
283             # Note: property for anchor
284 2     2 1 176 sub password : lvalue { return( shift->_set_get_uri_property( 'password', @_ ) ); }
285              
286             # Note: property for anchor
287 3     3 1 1612 sub pathname : lvalue { return( shift->_set_get_uri_property( 'pathname', @_ ) ); }
288              
289             # Note: property for input
290 0     0 1 0 sub pattern : lvalue { return( shift->_set_get_property( 'pattern', @_ ) ); }
291              
292             # Note: property for input
293 0     0 1 0 sub placeholder : lvalue { return( shift->_set_get_property( 'placeholder', @_ ) ); }
294              
295             # Note: property for anchor
296 2     2 0 1025 sub port : lvalue { return( shift->_set_get_uri_property( 'port', @_ ) ); }
297              
298             # Note: property for anchor
299 4     4 0 1516 sub protocol : lvalue { return( shift->_set_get_uri_property( 'protocol', @_ ) ); }
300              
301             # Note: property boolean for input
302 0     0 1 0 sub readOnly : lvalue { return( shift->_set_get_property( { attribute => 'readonly', is_boolean => 1 }, @_ ) ); }
303              
304             # Note: property for anchor
305 2     2 0 254 sub referrerPolicy : lvalue { return( shift->_set_get_property( 'referrerpolicy', @_ ) ); }
306              
307             # Note: property for anchor
308 3     3 1 1186 sub rel : lvalue { return( shift->_set_get_property( 'rel', @_ ) ); }
309              
310             # Note: property for anchor
311             sub relList
312             {
313 3     3 0 36121 my $self = shift( @_ );
314 3 100       12 unless( $self->{_rel_list} )
315             {
316 1         3 my $rel = $self->attr( 'rel' );
317 1         1122 require HTML::Object::TokenList;
318 1   50     15 $self->{_rel_list} = HTML::Object::TokenList->new( $rel, element => $self, attribute => 'rel', debug => $self->debug ) ||
319             return( $self->pass_error( HTML::Object::TokenList->error ) );
320             }
321 3         20 return( $self->{_rel_list} );
322             }
323              
324             # Note: method
325 0     0 1 0 sub reportValidity { return( shift->_set_get_boolean( 'reportValidity', @_ ) ); }
326              
327             # Note: property for input
328 0     0 1 0 sub required : lvalue { return( shift->_set_get_property( { attribute => 'required', is_boolean => 1 }, @_ ) ); }
329              
330             # Note: property for input
331 0     0 1 0 sub selectionDirection : lvalue { return( shift->_set_get_property( 'selectiondirection', @_ ) ); }
332              
333             # Note: property for input
334 0     0 1 0 sub selectionEnd : lvalue { return( shift->_set_get_property( 'selectionend', @_ ) ); }
335              
336             # Note: property for input
337 0     0 1 0 sub selectionStart : lvalue { return( shift->_set_get_property( 'selectionstart', @_ ) ); }
338              
339             # Note: property for anchor
340 2     2 1 33210 sub search : lvalue { return( shift->_set_get_uri_property( 'search', @_ ) ); }
341              
342             # Note: method for fieldset, input, object
343 0     0 0 0 sub setCustomValidity { return( shift->_set_get_scalar_as_object( 'setcustomvalidity', @_ ) ); }
344              
345 0     0 1 0 sub size : lvalue { return( shift->_set_get_property( 'selectionstart', @_ ) ); }
346              
347             # Note: property for input
348 0     0 1 0 sub src : lvalue { return( shift->_set_get_property( { attribute => 'src', is_uri => 1 }, @_ ) ); }
349              
350             # Note: property for input
351 0     0 1 0 sub step : lvalue { return( shift->_set_get_property( 'step', @_ ) ); }
352              
353             # Note: tabIndex is inherited directly HTML::Object::DOM::Element
354              
355             # Note: property for anchor
356 2     2 0 1354 sub target : lvalue { return( shift->_set_get_property( 'target', @_ ) ); }
357              
358             # Note: property for input
359 1     1 1 1052 sub type : lvalue { return( shift->_set_get_property( 'type', @_ ) ); }
360              
361             # Note: property for img, input
362 0     0 0 0 sub useMap : lvalue { return( shift->_set_get_property( 'usemap', @_ ) ); }
363              
364             # Note: property for anchor
365 2     2 0 1043 sub username : lvalue { return( shift->_set_get_uri_property( 'username', @_ ) ); }
366              
367             # Note: property for input
368 111     111 1 9893 sub value : lvalue { return( shift->_set_get_property( 'value', @_ ) ); }
369              
370             # Note: property read-only for input
371 0     0 1   sub validationMessage : lvalue { return( shift->_set_get_scalar_as_object( 'validationmessage', @_ ) ); }
372              
373             # Note: property read-only for input
374 0     0 1   sub validity { return( shift->_set_get_object( 'validity', 'HTML::Object::DOM::ValidityState', @_ ) ); }
375              
376             # Note: property for input
377 0     0 1   sub valueAsDate : lvalue { return( shift->_set_get_property( { attribute => 'value', is_datetime => 1 }, @_ ) ); }
378              
379             # Note: property for input
380 0     0 1   sub valueAsNumber : lvalue { return( shift->_set_get_property( { attribute => 'value', is_number => 1 }, @_ ) ); }
381              
382             # Note: property boolean for input
383 0     0 1   sub webkitdirectory : lvalue { return( shift->_set_get_property( { attribute => 'webkitdirectory', is_boolean => 1 }, @_ ) ); }
384              
385 0     0 1   sub webkitEntries { return; }
386              
387             # Note: property read-only for input
388 0     0 1   sub willValidate : lvalue { return( shift->_set_get_boolean( 'willvalidate', @_ ) ); }
389              
390             # Note: property for input
391 0     0 1   sub width : lvalue { return( shift->_set_get_property( 'width', @_ ) ); }
392              
393             1;
394             # NOTE: POD
395             __END__
396              
397             =encoding utf-8
398              
399             =head1 NAME
400              
401             HTML::Object::DOM::Element::Shared - HTML Object DOM Form Shared Code
402              
403             =head1 SYNOPSIS
404              
405             use HTML::Object::DOM::Element::Shared qw( :input );
406              
407             =head1 VERSION
408              
409             v0.2.0
410              
411             =head1 DESCRIPTION
412              
413             This module implements properties and methods shared among several form elements
414              
415             =head1 PROPERTIES
416              
417             =head2 accept
418              
419             Set or return the element's accept attribute, containing comma-separated list of file types accepted by the server when type is file.
420              
421             =head2 accessKey
422              
423             Sets or gets the element's attribute representing a string containing a single character that switches input focus to the control when pressed.
424              
425             =for Pod::Coverage align
426              
427             =head2 allowdirs
428              
429             Set or get a boolean value. This does not do anything otherwise since this is not an attribute.
430              
431             This is part of Mozilla non-standard Directory Upload API. It indicates whether or not to allow directories and files both to be selected in the file list.
432              
433             =head2 alt
434              
435             Sets or returns the element's alt attribute, containing alternative text to use when type is image.
436              
437             =head2 autocapitalize
438              
439             Defines the capitalization behavior for user input. Valid values are C<none>, C<off>, C<characters>, C<words>, or C<sentences>.
440              
441             =head2 autocomplete
442              
443             Set or returns a string that represents the element's autocomplete attribute, indicating whether the value of the control can be automatically completed by the browser. Ignored if the value of the type attribute is C<hidden>, C<checkbox>, C<radio>, C<file>, or a C<button> type (C<button>, C<submit>, C<reset>, C<image>). Possible values are:
444              
445             =over 4
446              
447             =item on
448              
449             The browser can autocomplete the value using previously stored value
450              
451             =item off
452              
453             The user must explicity enter a value
454              
455             =back
456              
457             =head2 autofocus
458              
459             Set or returns a boolean value that represents the element's autofocus attribute, which specifies that a form control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form element in a document can have the autofocus attribute. It cannot be applied if the type attribute is set to hidden (that is, you cannot automatically set focus to a hidden control).
460              
461             =head2 checked
462              
463             Set or returns a boolean value the current state of the element when type is checkbox or radio.
464              
465             =for Pod::Coverage compact
466              
467             =head2 crossOrigin
468              
469             A string of a keyword specifying the CORS mode to use when fetching the image resource. If you do not specify crossOrigin, the underlying element is fetched without CORS (the fetch no-cors mode).
470              
471             Permitted values are:
472              
473             =over 4
474              
475             =item * C<anonymous>
476              
477             Requests by the underlying element have their mode set to cors and their credentials mode set to same-origin. This means that CORS is enabled and credentials are sent if the underlying element is fetched from the same origin from which the document was loaded.
478              
479             =item * C<use-credentials>
480              
481             Requests by the L<HTML::Object::DOM::Element> will use the cors mode and the include credentials mode; all underlying element requests by the element will use CORS, regardless of what domain the fetch is from.
482              
483             =back
484              
485             If crossOrigin is an empty string (""), the anonymous mode is selected.
486              
487             See L<Mozilla documentation for more information|https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin>
488              
489             =for Pod::Coverage currentSrc
490              
491             =head2 defaultChecked
492              
493             Set or returns a boolean value that sets the default state of a radio button or checkbox as originally specified in HTML that created this object.
494              
495             =for Pod::Coverage defaultValue
496              
497             =head2 dirName
498              
499             Sets or gets the directionality of the element.
500              
501             =head2 disabled
502              
503             Set or returns a boolean value that represents the element's disabled attribute, indicating that the control is not available for interaction. The input values will not be submitted with the form. See also L</readonly>
504              
505             =for Pod::Coverage download
506              
507             =head2 files
508              
509             This returns a L<HTML::Object::DOM::FileList> object.
510              
511             Under JavaScript, this returns or accepts a C<FileList> object, which contains a list of C<File> objects representing the files selected for upload.
512              
513             =head2 form
514              
515             The C<form> HTML element represents a document section containing interactive controls for submitting information.
516              
517             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form>
518              
519             =head2 formAction
520              
521             Is a string reflecting the L<URI> of a resource that processes information submitted by the button. If specified, this property overrides the action attribute of the C<<form>> element that owns this element.
522              
523             This is used by L<HTML::Object::DOM::Element::Input>
524              
525             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/formAction>
526              
527             =head2 formEnctype
528              
529             Is a string reflecting the type of content that is used to submit the form to the server. If specified, this property overrides the enctype attribute of the C<<form>> element that owns this element.
530              
531             This is used by L<HTML::Object::DOM::Element::Input>
532              
533             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/formEnctype>
534              
535             =head2 formMethod
536              
537             Is a string reflecting the HTTP method that the browser uses to submit the form. If specified, this property overrides the method attribute of the <form> element that owns this element.
538              
539             This is used by L<HTML::Object::DOM::Element::Input>
540              
541             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/formMethod>
542              
543             =head2 formNoValidate
544              
545             Is a boolean value indicating that the form is not to be validated when it is submitted. If specified, this property overrides the novalidate attribute of the <form> element that owns this element.
546              
547             This is used by L<HTML::Object::DOM::Element::Input>
548              
549             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/formNoValidate>
550              
551             =head2 formTarget
552              
553             Is a string reflecting a name or keyword indicating where to display the response that is received after submitting the form. If specified, this property overrides the target attribute of the <form> element that owns this element.
554              
555             This is used by L<HTML::Object::DOM::Element::Input>
556              
557             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/formTarget>
558              
559             =head2 hash
560              
561             The hash property of the Location interface returns a string containing a '#' followed by the fragment identifier of the URL — the ID on the page that the URL is trying to target.
562              
563             The fragment is not percent-decoded. If the URL does not have a fragment identifier, this property contains an empty string, "".
564              
565             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/Location/hash>
566              
567             =head2 height
568              
569             Sets or returns the element's height attribute, which defines the height of the image displayed for the button, if the value of type is image.
570              
571             =head2 host
572              
573             The host property of the Location interface is a string containing the host, that is the hostname, and then, if the port of the URL is nonempty, a ':', and the port of the URL.
574              
575             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/Location/host>
576              
577             =head2 hostname
578              
579             The hostname property of the Location interface is a string containing the domain of the URL.
580              
581             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/Location/hostname>
582              
583             =head2 href
584              
585             The href property of the Location interface is a stringifier that returns a string containing the whole URL, and allows the href to be updated.
586              
587             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/Location/href>
588              
589             =for Pod::Coverage hreflang
590              
591             =head2 indeterminate
592              
593             Set or returns a boolean value that describes whether the checkbox or radio button is in indeterminate state. For checkboxes, the effect is that the appearance of the checkbox is obscured/greyed in some way as to indicate its state is indeterminate (not checked but not unchecked). Does not affect the value of the checked attribute, and clicking the checkbox will set the value to false.
594              
595             =head2 inputmode
596              
597             Provides a hint to browsers as to the type of virtual keyboard configuration to use when editing this element or its contents.
598              
599             =head2 labels
600              
601             Returns a list of C<<label>> elements that are labels for this element, as an L<array object|Module::Generic::Array>.
602              
603             =head2 list
604              
605             Sets or returns the L<element|HTML::Object::DOM::Element> pointed by the C<list> attribute, which returns an ID. The property may be C<undef> if no HTML element found in the same tree.
606              
607             =head2 max
608              
609             Set or returns a string that represents the element's C<max> attribute, containing the maximum (numeric or date-time) value for this item, which must not be less than its minimum (min attribute) value.
610              
611             =head2 maxLength
612              
613             Set or returns an integer that represents the element's C<maxlength> attribute, containing the maximum number of characters (in Unicode code points) that the value can have. (If you set this to a negative number, an exception will be thrown.)
614              
615             =head2 min
616              
617             Set or returns a string that represents the element's C<min> attribute, containing the minimum (numeric or date-time) value for this item, which must not be greater than its maximum (max attribute) value.
618              
619             =head2 minLength
620              
621             Set or returns an integer that represents the element's C<minlength> attribute, containing the minimum number of characters (in Unicode code points) that the value can have. (If you set this to a negative number, an exception will be thrown.)
622              
623             =head2 multiple
624              
625             Sets or returns a boolean that represents the element's multiple attribute, indicating whether more than one value is possible (e.g., multiple files).
626              
627             =head2 name
628              
629             Set or returns the element's name attribute, containing a name that identifies the element when submitting the form.
630              
631             =for Pod::Coverage origin
632              
633             =head2 password
634              
635             The password property of the Location interface is a string containing the password specified before the domain name.
636              
637             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/Location/password>
638              
639             =head2 pathname
640              
641             The pathname property of the Location interface is a USVString containing the path of the URL for the location, which will be the empty string if there is no path.
642              
643             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/Location/pathname>
644              
645             =head2 pattern
646              
647             Set or returns a string that represents the element's C<pattern> attribute, containing a regular expression that the control's value is checked against. Use the C<title> attribute to describe the pattern to help the user. This attribute applies when the value of the type attribute is C<text>, C<search>, C<tel>, C<url> or C<email>; otherwise it is ignored.
648              
649             =head2 placeholder
650              
651             Set or returns a string that represents the element's C<placeholder> attribute, containing a hint to the user of what can be entered in the control. The C<placeholder> text must not contain carriage returns or line-feeds. This attribute applies when the value of the type attribute is C<text>, C<search>, C<tel>, C<url> or C<email>; otherwise it is ignored.
652              
653             =for Pod::Coverage port
654              
655             =for Pod::Coverage protocol
656              
657             =head2 readOnly
658              
659             Set or returns a boolean that represents the element's C<readonly> attribute, indicating that the user cannot modify the value of the control.
660             This is ignored if the value of the type attribute is C<hidden>, C<range>, C<color>, C<checkbox>, C<radio>, C<file>, or a C<button> type.
661              
662             =for Pod::Coverage referrerPolicy
663              
664             =head2 rel
665              
666             The rel attribute defines the relationship between a linked resource and the current document.
667              
668             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel>
669              
670             =for Pod::Coverage relList
671              
672             =head2 required
673              
674             Set or returns a boolean value that represents the element's required attribute, indicating that the user must fill in a value before submitting a form.
675              
676             =head2 search
677              
678             The search property of the Location interface is a search string, also called a query string; that is, a USVString containing a '?' followed by the parameters of the URL.
679              
680             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/Location/search>
681              
682             =head2 selectionDirection
683              
684             Set or returns a string that represents the direction in which selection occurred. Possible values are:
685              
686             =over 4
687              
688             =item forward
689              
690             if selection was performed in the start-to-end direction of the current locale
691              
692             =item backward
693              
694             for the opposite direction
695              
696             =item none
697              
698             if the direction is unknown
699              
700             =back
701              
702             =head2 selectionEnd
703              
704             Set or returns an integer that represents the end index of the selected text. When there's no selection, this returns the offset of the character immediately following the current text input cursor position.
705              
706             =head2 selectionStart
707              
708             Set or returns an integer that represents the beginning index of the selected text. When nothing is selected, this returns the position of the text input cursor (caret) inside of the <input> element.
709              
710             =for Pod::Coverage setCustomValidity
711              
712             =head2 size
713              
714             Set or returns an integer that represents the element's C<size> attribute, containing visual size of the control. This value is in pixels unless the value of type is text or password, in which case, it is an integer number of characters. Applies only when type is set to C<text>, C<search>, C<tel>, C<url>, C<email>, or C<password>; otherwise it is ignored.
715              
716             =head2 step
717              
718             Set or returns the element's step attribute, which works with C<min> and C<max> to limit the increments at which a numeric or date-time value can be set. It can be the string any or a positive floating point number. If this is not set to C<any>, the control accepts only values at multiples of the step value greater than the minimum.
719              
720             =head2 src
721              
722             Sets or returns the element's src attribute, which specifies a URI for the location of an image to display on the graphical submit button, if the value of type is image; otherwise it is ignored.
723              
724             =for Pod::Coverage target
725              
726             =head2 type
727              
728             Set or returns the element's type attribute, indicating the type of control to display. See type attribute of C<<input>> for possible values.
729              
730             =for Pod::Coverage useMap
731              
732             =for Pod::Coverage username
733              
734             =head2 value
735              
736             Set or returns the current value of the control.
737              
738             =head2 valueAsDate
739              
740             Sets or returns the value of the element, interpreted as a L<DateTime> object, or C<undef> if conversion is not possible.
741              
742             =head2 valueAsNumber
743              
744             Returns the value of the L<element|HTML::Object::DOM::Element>, interpreted as one of the following, in order:
745              
746             =over 4
747              
748             =item * A time value
749              
750             =item * A number
751              
752             =item * C<undef> if conversion is impossible
753              
754             =back
755              
756             =head2 validity
757              
758             Read-only.
759              
760             L<ValidityState object|HTML::Object::DOM::ValidityState>: Returns the element's current validity state.
761              
762             =head2 validationMessage
763              
764             Read-only.
765              
766             Set or returns a localised message that describes the validation constraints that the control does not satisfy (if any). This is the empty string if the control is not a candidate for constraint validation (willvalidate is false), or it satisfies its constraints. This value can be set by the setCustomValidity method.
767              
768             =head2 webkitdirectory
769              
770             A boolean value: Returns the webkitdirectory attribute; if true, the file system picker interface only accepts directories instead of files.
771              
772             See L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory>
773              
774             =head2 webkitEntries
775              
776             This does nothing under perl, and returns C<undef>
777              
778             See L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitEntries>
779              
780             =head2 width
781              
782             Sets or returns the element's width attribute, which defines the width of the image displayed for the button, if the value of type is image.
783              
784             =head2 willValidate
785              
786             Read-only.
787              
788             Set or returns a boolean value that describes whether the element is a candidate for constraint validation. It is false if any conditions bar it from constraint validation, including: its type is hidden, reset, or button; it has a <datalist> ancestor; its disabled property is true.
789              
790             =head1 METHODS
791              
792             =head2 checkValidity
793              
794             In perl, this always returns true, or whatever value you would have set.
795              
796             In JavaScript environment, this returns true if the element's child controls are subject to constraint validation and satisfy those constraints; returns false if some controls do not satisfy their constraints. Fires an event named invalid at any control that does not satisfy its constraints; such controls are considered invalid if the event is not canceled. It is up to the programmer to decide how to respond to false.
797              
798             See also L<Mozilla documentation on form|https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/checkValidity>, L<Mozilla doc on input|https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/checkValidity>
799              
800             =head2 reportValidity
801              
802             In perl, this always returns true, or whatever value you would have set.
803              
804             In JavaScript environment, this returns true if the element's child controls satisfy their validation constraints. When false is returned, cancelable invalid events are fired for each invalid child and validation problems are reported to the user.
805              
806             Example:
807              
808             $doc->forms->myform->addEventListener( submit => sub
809             {
810             $doc->forms->myform->reportValidity();
811             }, { capture => 0 });
812              
813             See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/reportValidity>, L<Mozilla doc on input|https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/reportValidity>
814              
815             =head1 AUTHOR
816              
817             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
818              
819             =head1 SEE ALSO
820              
821             L<HTML::Object::DOM::Element>, L<HTML::Object::DOM::Element::Anchor> L<HTML::Object::DOM::Element::Area> L<HTML::Object::DOM::Element::Audio> L<HTML::Object::DOM::Element::Base> L<HTML::Object::DOM::Element::Body> L<HTML::Object::DOM::Element::BR> L<HTML::Object::DOM::Element::Button> L<HTML::Object::DOM::Element::Canvas> L<HTML::Object::DOM::Element::DataList> L<HTML::Object::DOM::Element::Data> L<HTML::Object::DOM::Element::Details> L<HTML::Object::DOM::Element::Dialog> L<HTML::Object::DOM::Element::Directory> L<HTML::Object::DOM::Element::Div> L<HTML::Object::DOM::Element::DList> L<HTML::Object::DOM::Element::Embed> L<HTML::Object::DOM::Element::FieldSet> L<HTML::Object::DOM::Element::Form> L<HTML::Object::DOM::Element::Heading> L<HTML::Object::DOM::Element::Head> L<HTML::Object::DOM::Element::HR> L<HTML::Object::DOM::Element::HTML> L<HTML::Object::DOM::Element::IFrame> L<HTML::Object::DOM::Element::Image> L<HTML::Object::DOM::Element::Input> L<HTML::Object::DOM::Element::Label> L<HTML::Object::DOM::Element::Legend> L<HTML::Object::DOM::Element::Link> L<HTML::Object::DOM::Element::LI> L<HTML::Object::DOM::Element::Map> L<HTML::Object::DOM::Element::Marquee> L<HTML::Object::DOM::Element::Media> L<HTML::Object::DOM::Element::Menu> L<HTML::Object::DOM::Element::Meta> L<HTML::Object::DOM::Element::Meter> L<HTML::Object::DOM::Element::Mod> L<HTML::Object::DOM::Element::Object> L<HTML::Object::DOM::Element::OList> L<HTML::Object::DOM::Element::OptGroup> L<HTML::Object::DOM::Element::Option> L<HTML::Object::DOM::Element::Output> L<HTML::Object::DOM::Element::Paragraph> L<HTML::Object::DOM::Element::Param> L<HTML::Object::DOM::Element::Picture> L<HTML::Object::DOM::Element::Pre> L<HTML::Object::DOM::Element::Progress> L<HTML::Object::DOM::Element::Quote> L<HTML::Object::DOM::Element::Script> L<HTML::Object::DOM::Element::Select> L<HTML::Object::DOM::Element::Slot> L<HTML::Object::DOM::Element::Source> L<HTML::Object::DOM::Element::Span> L<HTML::Object::DOM::Element::Style> L<HTML::Object::DOM::Element::TableCaption> L<HTML::Object::DOM::Element::TableCell> L<HTML::Object::DOM::Element::TableCol> L<HTML::Object::DOM::Element::Table> L<HTML::Object::DOM::Element::TableRow> L<HTML::Object::DOM::Element::TableSection> L<HTML::Object::DOM::Element::Template> L<HTML::Object::DOM::Element::TextArea> L<HTML::Object::DOM::Element::Time> L<HTML::Object::DOM::Element::Title> L<HTML::Object::DOM::Element::Track> L<HTML::Object::DOM::Element::UList> L<HTML::Object::DOM::Element::Unknown> L<HTML::Object::DOM::Element::Video>
822              
823             =head1 COPYRIGHT & LICENSE
824              
825             Copyright(c) 2021 DEGUEST Pte. Ltd.
826              
827             All rights reserved
828              
829             This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
830              
831             =cut