« blib/lib/HTML/Object/DOM/Element/Template.pm
↑ Summary
blib/lib/HTML/Object/DOM/Element/UList.pm »
| 1 | ##---------------------------------------------------------------------------- | ||
| 2 | ## HTML Object - ~/lib/HTML/Object/DOM/Element/Time.pm | ||
| 3 | ## Version v0.2.0 | ||
| 4 | ## Copyright(c) 2022 DEGUEST Pte. Ltd. | ||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||
| 6 | ## Created 2022/01/09 | ||
| 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::Time; | ||
| 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 | our $VERSION = 'v0.2.0'; | ||
| 23 | }; | ||
| 24 | |||
| 25 | use strict; | ||
| 26 | use warnings; | ||
| 27 | |||
| 28 | sub init | ||
| 29 | { | ||
| 30 | my $self = shift( @_ ); | ||
| 31 | $self->{_init_strict_use_sub} = 1; | ||
| 32 | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||
| 33 | $self->{tag} = 'time' if( !CORE::length( "$self->{tag}" ) ); | ||
| 34 | return( $self ); | ||
| 35 | } | ||
| 36 | |||
| 37 | # Note: property dateTime | ||
| 38 | sub dateTime : lvalue { return( shift->_set_get_property( 'datetime', @_ ) ); } | ||
| 39 | |||
| 40 | 1; | ||
| 41 | # NOTE: POD | ||
| 42 | __END__ | ||
| 43 | |||
| 44 | =encoding utf-8 | ||
| 45 | |||
| 46 | =head1 NAME | ||
| 47 | |||
| 48 | HTML::Object::DOM::Element::Time - HTML Object DOM Time Class | ||
| 49 | |||
| 50 | =head1 SYNOPSIS | ||
| 51 | |||
| 52 | use HTML::Object::DOM::Element::Time; | ||
| 53 | my $time = HTML::Object::DOM::Element::Time->new || | ||
| 54 | die( HTML::Object::DOM::Element::Time->error, "\n" ); | ||
| 55 | |||
| 56 | =head1 VERSION | ||
| 57 | |||
| 58 | v0.2.0 | ||
| 59 | |||
| 60 | =head1 DESCRIPTION | ||
| 61 | |||
| 62 | This interface provides special properties (beyond the regular L<HTML::Object::DOM::Element> interface it also has available to it by inheritance) for manipulating <time> elements. | ||
| 63 | |||
| 64 | =head1 INHERITANCE | ||
| 65 | |||
| 66 | +-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ +----------------------------------+ | ||
| 67 | | HTML::Object::Element | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Node | --> | HTML::Object::DOM::Element | --> | HTML::Object::DOM::Element::Time | | ||
| 68 | +-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ +----------------------------------+ | ||
| 69 | |||
| 70 | =head1 PROPERTIES | ||
| 71 | |||
| 72 | Inherits properties from its parent L<HTML::Object::DOM::Element> | ||
| 73 | |||
| 74 | =head2 dateTime | ||
| 75 | |||
| 76 | Is a string that reflects the datetime HTML attribute, containing a machine-readable form of the element's date and time value. | ||
| 77 | |||
| 78 | Example: | ||
| 79 | |||
| 80 | # Assumes there is <time id="t"> element in the HTML | ||
| 81 | |||
| 82 | my $t = $doc->getElementById( 't' ); | ||
| 83 | $t->dateTime = "6w 5h 34m 5s"; | ||
| 84 | |||
| 85 | See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLTimeElement/dateTime> | ||
| 86 | |||
| 87 | =head1 METHODS | ||
| 88 | |||
| 89 | Inherits methods from its parent L<HTML::Object::DOM::Element> | ||
| 90 | |||
| 91 | =head1 AUTHOR | ||
| 92 | |||
| 93 | Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> | ||
| 94 | |||
| 95 | =head1 SEE ALSO | ||
| 96 | |||
| 97 | L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/HTMLTimeElement>, L<Mozilla documentation on time element|https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time> | ||
| 98 | |||
| 99 | =head1 COPYRIGHT & LICENSE | ||
| 100 | |||
| 101 | Copyright(c) 2022 DEGUEST Pte. Ltd. | ||
| 102 | |||
| 103 | All rights reserved | ||
| 104 | |||
| 105 | This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. | ||
| 106 | |||
| 107 | =cut |