| 1 | ##---------------------------------------------------------------------------- | ||
| 2 | ## HTML Object - ~/lib/HTML/Object/DOM/Element/Meter.pm | ||
| 3 | ## Version v0.2.0 | ||
| 4 | ## Copyright(c) 2022 DEGUEST Pte. Ltd. | ||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||
| 6 | ## Created 2022/01/10 | ||
| 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::Meter; | ||
| 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( :meter ); | ||
| 23 | our $VERSION = 'v0.2.0'; | ||
| 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} = 'meter' if( !CORE::length( "$self->{tag}" ) ); | ||
| 35 | return( $self ); | ||
| 36 | } | ||
| 37 | |||
| 38 | # Note: property high | ||
| 39 | sub high : lvalue { return( shift->_set_get_property( 'high', @_ ) ); } | ||
| 40 | |||
| 41 | # Note: property labels read-only is inherited | ||
| 42 | |||
| 43 | # Note: property low | ||
| 44 | sub low : lvalue { return( shift->_set_get_property( 'low', @_ ) ); } | ||
| 45 | |||
| 46 | # Note: property max is inherited | ||
| 47 | |||
| 48 | # Note: property min is inherited | ||
| 49 | |||
| 50 | # Note: property optimum | ||
| 51 | sub optimum : lvalue { return( shift->_set_get_property( 'optimum', @_ ) ); } | ||
| 52 | |||
| 53 | # Note: property value is inherited | ||
| 54 | |||
| 55 | 1; | ||
| 56 | # NOTE: POD | ||
| 57 | __END__ | ||
| 58 | |||
| 59 | =encoding utf-8 | ||
| 60 | |||
| 61 | =head1 NAME | ||
| 62 | |||
| 63 | HTML::Object::DOM::Element::Meter - HTML Object DOM Meter Class | ||
| 64 | |||
| 65 | =head1 SYNOPSIS | ||
| 66 | |||
| 67 | use HTML::Object::DOM::Element::Meter; | ||
| 68 | my $meter = HTML::Object::DOM::Element::Meter->new || | ||
| 69 | die( HTML::Object::DOM::Element::Meter->error, "\n" ); | ||
| 70 | |||
| 71 | =head1 VERSION | ||
| 72 | |||
| 73 | v0.2.0 | ||
| 74 | |||
| 75 | =head1 DESCRIPTION | ||
| 76 | |||
| 77 | The HTML <meter> elements expose the HTMLMeterElement interface, which provides special properties and methods (beyond the L<HTML::Object::DOM::Element> object interface they also have available to them by inheritance) for manipulating the layout and presentation of <meter> elements. | ||
| 78 | |||
| 79 | =head1 INHERITANCE | ||
| 80 | |||
| 81 | +-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ +-----------------------------------+ | ||
| 82 | | HTML::Object::Element | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Node | --> | HTML::Object::DOM::Element | --> | HTML::Object::DOM::Element::Meter | | ||
| 83 | +-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ +-----------------------------------+ | ||
| 84 | |||
| 85 | =head1 PROPERTIES | ||
| 86 | |||
| 87 | Inherits properties from its parent L<HTML::Object::DOM::Element> | ||
| 88 | |||
| 89 | =head2 high | ||
| 90 | |||
| 91 | A double representing the value of the high boundary, reflecting the high attribute. | ||
| 92 | |||
| 93 | See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLMeterElement/high> | ||
| 94 | |||
| 95 | =head2 labels | ||
| 96 | |||
| 97 | Read-only. | ||
| 98 | |||
| 99 | A C<NodeList> of <label> elements that are associated with the element. | ||
| 100 | |||
| 101 | Example: | ||
| 102 | |||
| 103 | my $labelElements = meter->labels; | ||
| 104 | |||
| 105 | <label id="label1" for="test">Label 1</label> | ||
| 106 | <meter id="test" min="0" max="100" value="70">70</meter> | ||
| 107 | <label id="label2" for="test">Label 2</label> | ||
| 108 | |||
| 109 | Another example: | ||
| 110 | |||
| 111 | window->addEventListener( DOMContentLoaded => sub | ||
| 112 | { | ||
| 113 | my $meter = $doc->getElementById( 'test' ); | ||
| 114 | for( my $i = 0; $i < $meter->labels->length; $i++ ) | ||
| 115 | { | ||
| 116 | say( $meter->labels->[$i]->textContent ); # "Label 1" and "Label 2" | ||
| 117 | } | ||
| 118 | }); | ||
| 119 | |||
| 120 | See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLMeterElement/labels> | ||
| 121 | |||
| 122 | =head2 low | ||
| 123 | |||
| 124 | A double representing the value of the low boundary, reflecting the lowattribute. | ||
| 125 | |||
| 126 | See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLMeterElement/low> | ||
| 127 | |||
| 128 | =head2 max | ||
| 129 | |||
| 130 | A double representing the maximum value, reflecting the max attribute. | ||
| 131 | |||
| 132 | See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLMeterElement/max> | ||
| 133 | |||
| 134 | =head2 min | ||
| 135 | |||
| 136 | A double representing the minimum value, reflecting the min attribute. | ||
| 137 | |||
| 138 | See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLMeterElement/min> | ||
| 139 | |||
| 140 | =head2 optimum | ||
| 141 | |||
| 142 | A double representing the optimum, reflecting the optimum attribute. | ||
| 143 | |||
| 144 | See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLMeterElement/optimum> | ||
| 145 | |||
| 146 | =head2 value | ||
| 147 | |||
| 148 | A double representing the currrent value, reflecting the value attribute. | ||
| 149 | |||
| 150 | See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLMeterElement/value> | ||
| 151 | |||
| 152 | =head1 METHODS | ||
| 153 | |||
| 154 | Inherits methods from its parent L<HTML::Object::DOM::Element> | ||
| 155 | |||
| 156 | =head1 AUTHOR | ||
| 157 | |||
| 158 | Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> | ||
| 159 | |||
| 160 | =head1 SEE ALSO | ||
| 161 | |||
| 162 | L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLMeterElement>, L<Mozilla documentation on meter element|https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meter> | ||
| 163 | |||
| 164 | =head1 COPYRIGHT & LICENSE | ||
| 165 | |||
| 166 | Copyright(c) 2022 DEGUEST Pte. Ltd. | ||
| 167 | |||
| 168 | All rights reserved | ||
| 169 | |||
| 170 | This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. | ||
| 171 | |||
| 172 | =cut |