| 1 | ##---------------------------------------------------------------------------- | ||||||||||||
| 2 | ## HTML Object - ~/lib/HTML/Object/DOM/Closing.pm | ||||||||||||
| 3 | ## Version v0.2.0 | ||||||||||||
| 4 | ## Copyright(c) 2021 DEGUEST Pte. Ltd. | ||||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||||||||||||
| 6 | ## Created 2021/12/13 | ||||||||||||
| 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::Closing; | ||||||||||||
| 15 | BEGIN | ||||||||||||
| 16 | { | ||||||||||||
| 17 | 32 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 18 | 32 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 19 | 32 | ▶ | warnings::register_categories( 'HTML::Object' ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 20 | 32 | ▶ | use parent qw( HTML::Object::Closing HTML::Object::DOM::Node ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 21 | 32 | ▶ | use vars qw( $VERSION ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 22 | 32 | our $VERSION = 'v0.2.0'; | |||||||||||
| 23 | }; | ||||||||||||
| 24 | |||||||||||||
| 25 | 32 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 26 | 32 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 27 | |||||||||||||
| 28 | sub init | ||||||||||||
| 29 | { | ||||||||||||
| 30 | 319 | ▶ | my $self = shift( @_ ); | ||||||||||
|
Subroutine
init: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||
| 31 | 319 | $self->{_init_strict_use_sub} = 1; | |||||||||||
| 32 | 319 | ▶ | $self->HTML::Object::Closing::init( @_ ) || return( $self->pass_error ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 33 | 319 | return( $self ); | |||||||||||
| 34 | } | ||||||||||||
| 35 | |||||||||||||
| 36 | 0 | ▶ | sub getAttributes { return( wantarray() ? () : [] ); } | ||||||||||
|
Subroutine
getAttributes: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||
| 37 | |||||||||||||
| 38 | 0 | ▶ | sub getChildNodes { return( wantarray() ? () : [] ); } | ||||||||||
|
Subroutine
getChildNodes: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||
| 39 | |||||||||||||
| 40 | 0 | ▶ | sub getElementById { return; } | ||||||||||
|
Subroutine
getElementById: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 41 | |||||||||||||
| 42 | 0 | ▶ | sub getFirstChild { return; } | ||||||||||
|
Subroutine
getFirstChild: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 43 | |||||||||||||
| 44 | 0 | ▶ | sub getLastChild { return; } | ||||||||||
|
Subroutine
getLastChild: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 45 | |||||||||||||
| 46 | 0 | ▶ | sub getParentNode { return( shift->parent ); } | ||||||||||
|
Subroutine
getParentNode: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 47 | |||||||||||||
| 48 | 0 | ▶ | sub getRootNode { return( shift->parent->getRootNode ); } | ||||||||||
|
Subroutine
getRootNode: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 49 | |||||||||||||
| 50 | 0 | ▶ | sub isAttributeNode { return(0); } | ||||||||||
|
Subroutine
isAttributeNode: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 51 | |||||||||||||
| 52 | 0 | ▶ | sub isCommentNode { return(0); } | ||||||||||
|
Subroutine
isCommentNode: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 53 | |||||||||||||
| 54 | 0 | ▶ | sub isElementNode { return(0); } | ||||||||||
|
Subroutine
isElementNode: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 55 | |||||||||||||
| 56 | sub isEqualNode | ||||||||||||
| 57 | { | ||||||||||||
| 58 | 0 | ▶ | my $self = shift( @_ ); | ||||||||||
|
Subroutine
isEqualNode: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||
| 59 | 0 | ▶ | my $e = shift( @_ ) || return( $self->error( "No html element was provided to insert." ) ); | ||||||||||
|
Condition0%0/2
shift @_ || (return $self->error('No html element was provided to insert.'))
MC/DC0%0/1
shift @_ || (return $self->error('No html element was provided to insert.'))
shift @_
Truth table0%0/2
A
A= shift @_
| |||||||||||||
| 60 | 0 | ▶ | return( $self->error( "Element provided (", overload::StrVal( $e ), ") is not an HTML::Object::Element." ) ) if( !$self->_is_a( $e => 'HTML::Object::Element' ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 61 | 0 | ▶ | return(0) if( !$self->_is_a( $e => 'HTML::Object::Closing' ) ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 62 | 0 | return( $self->tag eq $e->tag ); | |||||||||||
| 63 | } | ||||||||||||
| 64 | 0 | ▶ | sub isNamespaceNode { return(0); } | ||||||||||
|
Subroutine
isNamespaceNode: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 65 | |||||||||||||
| 66 | 0 | ▶ | sub isPINode { return(0); } | ||||||||||
|
Subroutine
isPINode: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 67 | |||||||||||||
| 68 | 0 | ▶ | sub isProcessingInstructionNode { return(0); } | ||||||||||
|
Subroutine
isProcessingInstructionNode: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 69 | |||||||||||||
| 70 | 0 | ▶ | sub isTextNode { return(0); } | ||||||||||
|
Subroutine
isTextNode: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 71 | |||||||||||||
| 72 | 32 | 1; | |||||||||||
| 73 | # NOTE: POD | ||||||||||||
| 74 | __END__ | ||||||||||||
| 75 | |||||||||||||
| 76 | =encoding utf-8 | ||||||||||||
| 77 | |||||||||||||
| 78 | =head1 NAME | ||||||||||||
| 79 | |||||||||||||
| 80 | HTML::Object::DOM::Closing - HTML Object | ||||||||||||
| 81 | |||||||||||||
| 82 | =head1 SYNOPSIS | ||||||||||||
| 83 | |||||||||||||
| 84 | use HTML::Object::DOM::Closing; | ||||||||||||
| 85 | my $this = HTML::Object::DOM::Closing->new( tag => 'div' ) || | ||||||||||||
| 86 | die( HTML::Object::DOM::Closing->error, "\n" ); | ||||||||||||
| 87 | |||||||||||||
| 88 | =head1 VERSION | ||||||||||||
| 89 | |||||||||||||
| 90 | v0.2.0 | ||||||||||||
| 91 | |||||||||||||
| 92 | =head1 DESCRIPTION | ||||||||||||
| 93 | |||||||||||||
| 94 | This module implements a closing tag for the DOM. It inherits from L<HTML::Object::Closing> and L<HTML::Object::DOM::Node> | ||||||||||||
| 95 | |||||||||||||
| 96 | Closing tags exists, but are not part of the nodes, so they are transparent. | ||||||||||||
| 97 | |||||||||||||
| 98 | =head1 INHERITANCE | ||||||||||||
| 99 | |||||||||||||
| 100 | +-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ | ||||||||||||
| 101 | | HTML::Object::Element | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Node | --> | HTML::Object::DOM::Closing | | ||||||||||||
| 102 | +-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ | ||||||||||||
| 103 | | ^ | ||||||||||||
| 104 | | | | ||||||||||||
| 105 | v | | ||||||||||||
| 106 | +-----------------------+ | | ||||||||||||
| 107 | | HTML::Object::Closing | ------------------------------------------------------------------------+ | ||||||||||||
| 108 | +-----------------------+ | ||||||||||||
| 109 | |||||||||||||
| 110 | =head1 PROPERTIES | ||||||||||||
| 111 | |||||||||||||
| 112 | There is no property. | ||||||||||||
| 113 | |||||||||||||
| 114 | =head1 METHODS | ||||||||||||
| 115 | |||||||||||||
| 116 | =head2 getAttributes | ||||||||||||
| 117 | |||||||||||||
| 118 | Returns an empty list in list context, or an empty array reference in scalar context. | ||||||||||||
| 119 | |||||||||||||
| 120 | =head2 getChildNodes | ||||||||||||
| 121 | |||||||||||||
| 122 | Returns an empty list in list context, or an empty array reference in scalar context. | ||||||||||||
| 123 | |||||||||||||
| 124 | =head2 getElementById | ||||||||||||
| 125 | |||||||||||||
| 126 | Returns an empty list in list context, or C<undef> in scalar context. | ||||||||||||
| 127 | |||||||||||||
| 128 | =head2 getFirstChild | ||||||||||||
| 129 | |||||||||||||
| 130 | Returns an empty list in list context, or C<undef> in scalar context. | ||||||||||||
| 131 | |||||||||||||
| 132 | =head2 getLastChild | ||||||||||||
| 133 | |||||||||||||
| 134 | Returns an empty list in list context, or C<undef> in scalar context. | ||||||||||||
| 135 | |||||||||||||
| 136 | =head2 getParentNode | ||||||||||||
| 137 | |||||||||||||
| 138 | Returns the parent node, if any. | ||||||||||||
| 139 | |||||||||||||
| 140 | =head2 getRootNode | ||||||||||||
| 141 | |||||||||||||
| 142 | Returns the L<root node|HTML::Object::DOM::Document> | ||||||||||||
| 143 | |||||||||||||
| 144 | =head2 isAttributeNode | ||||||||||||
| 145 | |||||||||||||
| 146 | Returns false. | ||||||||||||
| 147 | |||||||||||||
| 148 | =head2 isCommentNode | ||||||||||||
| 149 | |||||||||||||
| 150 | Returns false. | ||||||||||||
| 151 | |||||||||||||
| 152 | =head2 isElementNode | ||||||||||||
| 153 | |||||||||||||
| 154 | Returns false. | ||||||||||||
| 155 | |||||||||||||
| 156 | =head2 isEqualNode | ||||||||||||
| 157 | |||||||||||||
| 158 | Provided with another element object, and this returns true if both closing element have the same tag value, or false otherwise. | ||||||||||||
| 159 | |||||||||||||
| 160 | =head2 isNamespaceNode | ||||||||||||
| 161 | |||||||||||||
| 162 | Returns false. | ||||||||||||
| 163 | |||||||||||||
| 164 | =head2 isPINode | ||||||||||||
| 165 | |||||||||||||
| 166 | Returns false. | ||||||||||||
| 167 | |||||||||||||
| 168 | =head2 isProcessingInstructionNode | ||||||||||||
| 169 | |||||||||||||
| 170 | Returns false. | ||||||||||||
| 171 | |||||||||||||
| 172 | =head2 isTextNode | ||||||||||||
| 173 | |||||||||||||
| 174 | Returns false. | ||||||||||||
| 175 | |||||||||||||
| 176 | =head1 AUTHOR | ||||||||||||
| 177 | |||||||||||||
| 178 | Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> | ||||||||||||
| 179 | |||||||||||||
| 180 | =head1 SEE ALSO | ||||||||||||
| 181 | |||||||||||||
| 182 | L<HTML::Object::Element/close> | ||||||||||||
| 183 | |||||||||||||
| 184 | =head1 COPYRIGHT & LICENSE | ||||||||||||
| 185 | |||||||||||||
| 186 | Copyright(c) 2021 DEGUEST Pte. Ltd. | ||||||||||||
| 187 | |||||||||||||
| 188 | All rights reserved | ||||||||||||
| 189 | |||||||||||||
| 190 | This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. | ||||||||||||
| 191 | |||||||||||||
| 192 | =cut | ||||||||||||