| 1 | ##---------------------------------------------------------------------------- | ||||||||||
| 2 | ## HTML Object - ~/lib/HTML/Object/DOM/Element/Form.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::Form; | ||||||||||
| 15 | BEGIN | ||||||||||
| 16 | { | ||||||||||
| 17 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 3 | ▶ | warnings::register_categories( 'HTML::Object' ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 3 | ▶ | use parent qw( HTML::Object::DOM::Element ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 3 | ▶ | use vars qw( $VERSION ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 3 | ▶ | use HTML::Object::DOM::Element::Shared qw( :form ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | 3 | our $VERSION = 'v0.2.1'; | |||||||||
| 24 | }; | ||||||||||
| 25 | |||||||||||
| 26 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | |||||||||||
| 29 | sub init | ||||||||||
| 30 | { | ||||||||||
| 31 | 2 | ▶ | my $self = shift( @_ ); | ||||||||
|
Subroutine
init: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||
| 32 | 2 | $self->{checkValidity} = 1; | |||||||||
| 33 | 2 | $self->{reportValidity} = 1; | |||||||||
| 34 | 2 | $self->{_init_strict_use_sub} = 1; | |||||||||
| 35 | 2 | ▶ | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 2 | ▶ | $self->{tag} = 'form' if( !CORE::length( "$self->{tag}" ) ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 2 | return( $self ); | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | # Note: property attribute | ||||||||||
| 41 | 0 | ▶ | sub acceptCharset : lvalue { return( shift->_set_get_property( 'accept-charset', @_ ) ); } | ||||||||
|
Subroutine
acceptCharset: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 42 | |||||||||||
| 43 | # Note: property attribute | ||||||||||
| 44 | 0 | ▶ | sub action : lvalue { return( shift->_set_get_property( 'action', @_ ) ); } | ||||||||
|
Subroutine
action: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 45 | |||||||||||
| 46 | # Note: property accept inherited | ||||||||||
| 47 | |||||||||||
| 48 | # Note: property autocapitalize inherited | ||||||||||
| 49 | |||||||||||
| 50 | # Note: method checkValidity inherited | ||||||||||
| 51 | |||||||||||
| 52 | # Note: property read-only | ||||||||||
| 53 | # Same as in HTML::Object::DOM::FieldSet | ||||||||||
| 54 | sub elements | ||||||||||
| 55 | { | ||||||||||
| 56 | 0 | ▶ | my $self = shift( @_ ); | ||||||||
|
Subroutine
elements: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 57 | 0 | my $children = $self->children; | |||||||||
| 58 | # my $form_elements = $self->new_array( [qw( button datalist fieldset input label legend meter optgroup option output progress select textarea )] ); | ||||||||||
| 59 | # <https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/elements#value> | ||||||||||
| 60 | 0 | my $form_elements = $self->new_array( [qw( button fieldset input object output select textarea )] ); | |||||||||
| 61 | 0 | my $list = $form_elements->as_hash; | |||||||||
| 62 | 0 | ▶ | my $results = $children->grep(sub{ exists( $form_elements->{ $_->tag } ) }); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 63 | 0 | my $col = $self->new_collection_elements; | |||||||||
| 64 | 0 | $col->push( $results->list ); | |||||||||
| 65 | 0 | return( $col ); | |||||||||
| 66 | } | ||||||||||
| 67 | |||||||||||
| 68 | # Note: property | ||||||||||
| 69 | 0 | ▶ | sub encoding : lvalue { return( shift->_set_get_property( 'encoding', @_ ) ); } | ||||||||
|
Subroutine
encoding: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 70 | |||||||||||
| 71 | # Note: property | ||||||||||
| 72 | 0 | ▶ | sub length : lvalue { return( shift->_set_get_property( 'length', @_ ) ); } | ||||||||
|
Subroutine
length: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 73 | |||||||||||
| 74 | # Note: property | ||||||||||
| 75 | 0 | ▶ | sub method : lvalue { return( shift->_set_get_property( 'method', @_ ) ); } | ||||||||
|
Subroutine
method: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 76 | |||||||||||
| 77 | # Note: property name inherited | ||||||||||
| 78 | |||||||||||
| 79 | # Note: property | ||||||||||
| 80 | 0 | ▶ | sub noValidate : lvalue { return( shift->_set_get_property( { attribute => 'novalidate', is_boolean => 1 }, @_ ) ); } | ||||||||
|
Subroutine
noValidate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 81 | |||||||||||
| 82 | 0 | ▶ | sub requestSubmit { return( shift->_set_get_object_without_init( 'requestSubmit', 'HTML::Object::DOM::Element', @_ ) ); } | ||||||||
|
Subroutine
requestSubmit: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 83 | |||||||||||
| 84 | # Note: method reportValidity inherited | ||||||||||
| 85 | |||||||||||
| 86 | 0 | ▶ | sub submit { return; } | ||||||||
|
Subroutine
submit: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 87 | |||||||||||
| 88 | # Note: property target | ||||||||||
| 89 | 0 | ▶ | sub target : lvalue { return( shift->_set_get_property( { attribute => 'target', is_uri => 1 }, @_ ) ); } | ||||||||
|
Subroutine
target: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 90 | |||||||||||
| 91 | 3 | 1; | |||||||||
| 92 | # NOTE: POD | ||||||||||
| 93 | __END__ | ||||||||||