| 1 | ##---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 2 | ## HTML Object - ~/lib/HTML/Object/DOM/Element/Option.pm | ||||||||||||||||||||||||||||
| 3 | ## Version v0.3.0 | ||||||||||||||||||||||||||||
| 4 | ## Copyright(c) 2022 DEGUEST Pte. Ltd. | ||||||||||||||||||||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||||||||||||||||||||||||||||
| 6 | ## Created 2021/12/23 | ||||||||||||||||||||||||||||
| 7 | ## Modified 2025/10/16 | ||||||||||||||||||||||||||||
| 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::Option; | ||||||||||||||||||||||||||||
| 15 | BEGIN | ||||||||||||||||||||||||||||
| 16 | { | ||||||||||||||||||||||||||||
| 17 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 2 | ▶ | warnings::register_categories( 'HTML::Object' ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 2 | ▶ | use parent qw( HTML::Object::DOM::Element ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 2 | ▶ | use vars qw( $VERSION ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 2 | ▶ | use HTML::Object::DOM::Element::Shared qw( :option ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 2 | ▶ | use Wanted; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | 2 | our $VERSION = 'v0.3.0'; | |||||||||||||||||||||||||||
| 25 | }; | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 28 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | sub init | ||||||||||||||||||||||||||||
| 31 | { | ||||||||||||||||||||||||||||
| 32 | 4 | ▶ | my $self = shift( @_ ); | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||
| 33 | 4 | $self->{_init_strict_use_sub} = 1; | |||||||||||||||||||||||||||
| 34 | 4 | ▶ | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 4 | ▶ | $self->{tag} = 'option' if( !CORE::length( "$self->{tag}" ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | 4 | return( $self ); | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | # Note: property defaultSelected | ||||||||||||||||||||||||||||
| 40 | sub defaultSelected : lvalue { return( shift->_set_get_property({ | ||||||||||||||||||||||||||||
| 41 | attribute => 'selected', | ||||||||||||||||||||||||||||
| 42 | callback => sub | ||||||||||||||||||||||||||||
| 43 | { | ||||||||||||||||||||||||||||
| 44 | 12 | ▶ | my $self = shift( @_ ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 45 | 12 | my $attr = shift( @_ ); | |||||||||||||||||||||||||||
| 46 | 12 | ▶ | if( @_ ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | { | ||||||||||||||||||||||||||||
| 48 | 1 | my $value = shift( @_ ); | |||||||||||||||||||||||||||
| 49 | # Whatever true value we received, we change it to empty string so this becomes: | ||||||||||||||||||||||||||||
| 50 | # selected="" | ||||||||||||||||||||||||||||
| 51 | 1 | ▶ | $value = '' if( defined( $value ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | 1 | $self->attr( $attr => $value ); | |||||||||||||||||||||||||||
| 53 | 1 | $self->selected( $value ); | |||||||||||||||||||||||||||
| 54 | # Will also reset our parent, if any | ||||||||||||||||||||||||||||
| 55 | 1 | $self->reset(1); | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | else | ||||||||||||||||||||||||||||
| 58 | { | ||||||||||||||||||||||||||||
| 59 | 11 | ▶ | return( $self->attributes->has( 'selected' ) ? 1 : 0 ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | 12 | ▶ | }, @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
defaultSelected: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | # Note: property disabled is inherited | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | # Note: property form read-only inherited | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | # Note: property index read-only | ||||||||||||||||||||||||||||
| 69 | sub index | ||||||||||||||||||||||||||||
| 70 | { | ||||||||||||||||||||||||||||
| 71 | 1 | ▶ | my $self = shift( @_ ); | ||||||||||||||||||||||||||
|
Subroutine
index: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||
| 72 | 1 | my $parent = $self->parent; | |||||||||||||||||||||||||||
| 73 | 1 | ▶ | return if( !$parent ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 74 | 1 | ▶ | return if( !$parent->can( 'options' ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 75 | 1 | return( $parent->options->pos( $self ) ); | |||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | # Note: property label read-only | ||||||||||||||||||||||||||||
| 79 | sub label : lvalue { return( shift->_lvalue({ | ||||||||||||||||||||||||||||
| 80 | set => sub | ||||||||||||||||||||||||||||
| 81 | { | ||||||||||||||||||||||||||||
| 82 | 1 | ▶ | my $self = shift( @_ ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=22.3
| |||||||||||||||||||||||||||||
| 83 | 1 | my $val = shift( @_ ); | |||||||||||||||||||||||||||
| 84 | # User passed undef, so we remove all text from the option | ||||||||||||||||||||||||||||
| 85 | 1 | ▶ | if( !defined( $val ) ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | { | ||||||||||||||||||||||||||||
| 87 | 0 | $self->children->reset; | |||||||||||||||||||||||||||
| 88 | 0 | return( $self ); | |||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||
| 90 | 1 | ▶ | $val = $val->value if( $self->_is_a( $val => 'HTML::Object::DOM::Element::Text' ) || $self->_is_a( $val => 'HTML::Object::DOM::Element::Space' ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->_is_a($val, "HTML::Object::DOM::Element::Text") or $self->_is_a($val, "HTML::Object::DOM::Element::Space")
MC/DC0%0/2
$self->_is_a($val, "HTML::Object::DOM::Element::Text") or $self->_is_a($val, "HTML::Object::DOM::Element::Space")
$self->_is_a($val, "HTML::Object::DOM::Element::Text")
$self->_is_a($val, "HTML::Object::DOM::Element::Space")
Truth table33%1/3
A or B
A= $self->_is_a($val, "HTML::Object::DOM::Element::Text")B= $self->_is_a($val, "HTML::Object::DOM::Element::Space")
| |||||||||||||||||||||||||||||
| 91 | 1 | ▶ | return( $self->error({ | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $val and not overload::Method($val, "\"\"")
MC/DC0%0/2
ref $val and not overload::Method($val, "\"\"")
ref $val
not overload::Method($val, "\"\"")
Truth table33%1/3
A and not(B)
A= ref $valB= not overload::Method($val, "\"\"")
| |||||||||||||||||||||||||||||
| 92 | message => "Value provided ($val) is not a string.", | ||||||||||||||||||||||||||||
| 93 | class => 'HTML::Object::TypeError', | ||||||||||||||||||||||||||||
| 94 | }) ) if( ref( $val ) && !overload::Method( $val, '""' ) ); | ||||||||||||||||||||||||||||
| 95 | 1 | return( $self->attr( label => "$val" ) ); | |||||||||||||||||||||||||||
| 96 | }, | ||||||||||||||||||||||||||||
| 97 | get => sub | ||||||||||||||||||||||||||||
| 98 | { | ||||||||||||||||||||||||||||
| 99 | 2 | ▶ | my $self = shift( @_ ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 100 | 2 | my $label = $self->attr( 'label' ); | |||||||||||||||||||||||||||
| 101 | 2 | ▶ | if( defined( $label ) && CORE::length( "$label" ) ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $label and length "$label"
MC/DC50%1/2
defined $label and length "$label"
defined $label
length "$label"
Truth table66%2/3
A and B
A= defined $labelB= length "$label"
| |||||||||||||||||||||||||||||
| 102 | { | ||||||||||||||||||||||||||||
| 103 | 1 | return( $label ); | |||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | else | ||||||||||||||||||||||||||||
| 106 | { | ||||||||||||||||||||||||||||
| 107 | 1 | return( $self->text ); | |||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||
| 110 | 3 | ▶ | }, @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
label: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | # Note: property selected | ||||||||||||||||||||||||||||
| 113 | # Unintuitively enough, the one that affects the 'selected' attribute is the 'defaultSelected' method, not this 'selected' one ! This is just a boolean | ||||||||||||||||||||||||||||
| 114 | sub selected : lvalue | ||||||||||||||||||||||||||||
| 115 | { | ||||||||||||||||||||||||||||
| 116 | 2 | ▶ | my $self = shift( @_ ); | ||||||||||||||||||||||||||
|
Subroutine
selected: called CC=5 SCAR=16.4
Pod
documented
| |||||||||||||||||||||||||||||
| 117 | 2 | my $has_arg = 0; | |||||||||||||||||||||||||||
| 118 | 2 | my $arg; | |||||||||||||||||||||||||||
| 119 | 2 | ▶ | if( want( qw( LVALUE ASSIGN ) ) ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 120 | { | ||||||||||||||||||||||||||||
| 121 | 0 | ( $arg ) = want( 'ASSIGN' ); | |||||||||||||||||||||||||||
| 122 | 0 | $has_arg++; | |||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | else | ||||||||||||||||||||||||||||
| 125 | { | ||||||||||||||||||||||||||||
| 126 | 2 | ▶ | if( @_ ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 127 | { | ||||||||||||||||||||||||||||
| 128 | 1 | $arg = shift( @_ ); | |||||||||||||||||||||||||||
| 129 | 1 | $has_arg++; | |||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||
| 132 | # If a value is provided, this will set the internal boolean value, but will not affect the DOM attribute 'selected' | ||||||||||||||||||||||||||||
| 133 | 2 | ▶ | if( $has_arg ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 134 | { | ||||||||||||||||||||||||||||
| 135 | 1 | return( $self->_set_get_boolean( 'selected', $arg ) ); | |||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||
| 137 | # If no value is provided, we return true if the DOM attribute exists, no matter its value, or false otherwise | ||||||||||||||||||||||||||||
| 138 | else | ||||||||||||||||||||||||||||
| 139 | { | ||||||||||||||||||||||||||||
| 140 | 1 | ▶ | my $val = $self->attributes->has( 'selected' ) ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 141 | 1 | return( $val ); | |||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | # Note: property text | ||||||||||||||||||||||||||||
| 146 | # textContent is inherited from HTML::Object::DOM::Node and is also an lvalue method | ||||||||||||||||||||||||||||
| 147 | 5 | ▶ | sub text : lvalue { return( shift->textContent( @_ ) ); } | ||||||||||||||||||||||||||
|
Subroutine
text: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | # Note: property value | ||||||||||||||||||||||||||||
| 150 | sub value : lvalue | ||||||||||||||||||||||||||||
| 151 | { | ||||||||||||||||||||||||||||
| 152 | 6 | ▶ | my $self = shift( @_ ); | ||||||||||||||||||||||||||
|
Subroutine
value: called CC=5 SCAR=16.5
Pod
documented
| |||||||||||||||||||||||||||||
| 153 | 6 | my $has_arg = 0; | |||||||||||||||||||||||||||
| 154 | 6 | my $arg; | |||||||||||||||||||||||||||
| 155 | 6 | ▶ | if( want( qw( LVALUE ASSIGN ) ) ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 156 | { | ||||||||||||||||||||||||||||
| 157 | 2 | ( $arg ) = want( 'ASSIGN' ); | |||||||||||||||||||||||||||
| 158 | 2 | $has_arg++; | |||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | else | ||||||||||||||||||||||||||||
| 161 | { | ||||||||||||||||||||||||||||
| 162 | 4 | ▶ | if( @_ ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 163 | { | ||||||||||||||||||||||||||||
| 164 | 0 | $arg = shift( @_ ); | |||||||||||||||||||||||||||
| 165 | 0 | $has_arg++; | |||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | 6 | ▶ | if( $has_arg ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 169 | { | ||||||||||||||||||||||||||||
| 170 | 2 | return( $self->_set_get_property( 'value', $arg ) ); | |||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | else | ||||||||||||||||||||||||||||
| 173 | { | ||||||||||||||||||||||||||||
| 174 | 4 | ▶ | return( $self->attributes->has( 'value' ) ? $self->attr( 'value' ) : $self->textContent ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 2 | 1; | |||||||||||||||||||||||||||
| 179 | # NOTE: POD | ||||||||||||||||||||||||||||
| 180 | __END__ | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | =encoding utf-8 | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | =head1 NAME | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | HTML::Object::DOM::Element::Option - HTML Object DOM Option Class | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | use HTML::Object::DOM::Element::Option; | ||||||||||||||||||||||||||||
| 191 | my $opt = HTML::Object::DOM::Element::Option->new || | ||||||||||||||||||||||||||||
| 192 | die( HTML::Object::DOM::Element::Option->error, "\n" ); | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | =head1 VERSION | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | v0.3.0 | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | This interface represents C<<option>> elements and inherits all properties and methods of the L<HTML::Object::Element> interface. | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | =head1 INHERITANCE | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | +-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ +------------------------------------+ | ||||||||||||||||||||||||||||
| 205 | | HTML::Object::Element | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Node | --> | HTML::Object::DOM::Element | --> | HTML::Object::DOM::Element::Option | | ||||||||||||||||||||||||||||
| 206 | +-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ +------------------------------------+ | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | =head1 PROPERTIES | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | Inherits properties from its parent L<HTML::Object::DOM::Element> | ||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | =head2 defaultSelected | ||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | Has a value of either true or false that shows the initial value of the selected HTML attribute, indicating whether the option is selected by default or not. | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement/defaultSelected> | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | =head2 disabled | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | Has a value of either true or false representing the value of the disabled HTML attribute, which indicates that the option is unavailable to be selected. An option can also be disabled if it is a child of an <optgroup> element that is disabled. | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement/disabled> | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | =head2 form | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | Read-only. | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | Is a L<HTML::Object::DOM::Element::Form> representing the same value as the form of the corresponding <select> element, if the option is a descendant of a <select> element, or C<undef> if none is found. | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement/form> | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | =head2 index | ||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | Read-only. | ||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | Is a long representing the position of the option within the list of options it belongs to, in tree-order. If the option is not part of a list of options, like when it is part of the C<datalist> element, the value is C<undef>. | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement/index> | ||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | =head2 label | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | Read-only. | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | Is a string that reflects the value of the label HTML attribute, which provides a label for the option. If this attribute is not specifically set, reading it returns the element's text content. | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement/label> | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | =head2 selected | ||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | Has a value of either true or false that indicates whether the option is currently selected. | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement/selected> | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | =head2 text | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | Is a string that contains the text content of the element. | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement/text> | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | =head2 value | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | Is a string that reflects the value of the value HTML attribute, if it exists; otherwise reflects value of the Node.textContent property. | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement/value> | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | =head1 METHODS | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | Inherits methods from its parent L<HTML::Object::DOM::Element> | ||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement>, L<Mozilla documentation on option element|https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option> | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | Copyright(c) 2021 DEGUEST Pte. Ltd. | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | All rights reserved | ||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||
| 286 | =cut | ||||||||||||||||||||||||||||