| 1 | ##---------------------------------------------------------------------------- | ||
| 2 | ## HTML Object - ~/lib/HTML/Object/DOM/Element/Output.pm | ||
| 3 | ## Version v0.2.0 | ||
| 4 | ## Copyright(c) 2021 DEGUEST Pte. Ltd. | ||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||
| 6 | ## Created 2021/12/23 | ||
| 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::Output; | ||
| 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( :output ); | ||
| 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->{defaultvalue} = undef; | ||
| 33 | $self->{_init_strict_use_sub} = 1; | ||
| 34 | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||
| 35 | $self->{tag} = 'output' if( !CORE::length( "$self->{tag}" ) ); | ||
| 36 | $self->{type} = 'output'; | ||
| 37 | $self->_set_get_internal_attribute_callback( 'for' => sub | ||
| 38 | { | ||
| 39 | my( $this, $val ) = @_; | ||
| 40 | my $list; | ||
| 41 | return if( !( $list = $this->{_for_list} ) ); | ||
| 42 | # $list->debug( $self->debug ); | ||
| 43 | $list->update( $val ); | ||
| 44 | }); | ||
| 45 | return( $self ); | ||
| 46 | } | ||
| 47 | |||
| 48 | # Note: method checkValidity inherited | ||
| 49 | |||
| 50 | # Note: property defaultValue | ||
| 51 | sub defaultValue : lvalue { return( shift->_set_get_property( 'defaultvalue', @_ ) ); } | ||
| 52 | |||
| 53 | # Note: property form read-only inherited | ||
| 54 | |||
| 55 | # Note: property htmlFor read-only | ||
| 56 | sub htmlFor | ||
| 57 | { | ||
| 58 | my $self = shift( @_ ); | ||
| 59 | unless( $self->{_for_list} ) | ||
| 60 | { | ||
| 61 | my $for = $self->attr( 'for' ); | ||
| 62 | require HTML::Object::TokenList; | ||
| 63 | $self->{_for_list} = HTML::Object::TokenList->new( $for, element => $self, attribute => 'for', debug => $self->debug ) || | ||
| 64 | return( $self->pass_error( HTML::Object::TokenList->error ) ); | ||
| 65 | } | ||
| 66 | return( $self->{_for_list} ); | ||
| 67 | } | ||
| 68 | |||
| 69 | # Note: property labels read-only inherited | ||
| 70 | |||
| 71 | # Note: property name inherited | ||
| 72 | |||
| 73 | # Note: method reportValidity inherited | ||
| 74 | |||
| 75 | # Note: method setCustomValidity inherited | ||
| 76 | |||
| 77 | # Note: property type read-only inherited | ||
| 78 | |||
| 79 | # Note: property validationMessage read-only inherited | ||
| 80 | |||
| 81 | # Note: property validity read-only inherited | ||
| 82 | |||
| 83 | # Note: property value | ||
| 84 | { | ||
| 85 | no warnings 'redefine'; | ||
| 86 | sub value : lvalue { return( shift->textContent( @_ ) ); } | ||
| 87 | } | ||
| 88 | |||
| 89 | # Note: property willValidate read-only inherited | ||
| 90 | |||
| 91 | 1; | ||
| 92 | # NOTE: POD | ||
| 93 | __END__ |