line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
## HTML Object - ~/lib/HTML/Object/DOM/Comment.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::Comment; |
15
|
|
|
|
|
|
|
BEGIN |
16
|
|
|
|
|
|
|
{ |
17
|
28
|
|
|
28
|
|
195
|
use strict; |
|
28
|
|
|
|
|
56
|
|
|
28
|
|
|
|
|
899
|
|
18
|
28
|
|
|
28
|
|
135
|
use warnings; |
|
28
|
|
|
|
|
69
|
|
|
28
|
|
|
|
|
826
|
|
19
|
28
|
|
|
28
|
|
155
|
use parent qw( HTML::Object::Comment HTML::Object::DOM::CharacterData ); |
|
28
|
|
|
|
|
51
|
|
|
28
|
|
|
|
|
210
|
|
20
|
28
|
|
|
28
|
|
1893
|
use vars qw( $VERSION ); |
|
28
|
|
|
|
|
64
|
|
|
28
|
|
|
|
|
1147
|
|
21
|
28
|
|
|
28
|
|
504
|
our $VERSION = 'v0.2.0'; |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
28
|
|
|
28
|
|
135
|
use strict; |
|
28
|
|
|
|
|
50
|
|
|
28
|
|
|
|
|
479
|
|
25
|
28
|
|
|
28
|
|
124
|
use warnings; |
|
28
|
|
|
|
|
47
|
|
|
28
|
|
|
|
|
9618
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub init |
28
|
|
|
|
|
|
|
{ |
29
|
6
|
|
|
6
|
1
|
528
|
my $self = shift( @_ ); |
30
|
6
|
|
|
|
|
835
|
$self->{_init_strict_use_sub} = 1; |
31
|
6
|
50
|
|
|
|
57
|
$self->HTML::Object::Comment::init( @_ ) || return( $self->pass_error ); |
32
|
6
|
|
|
|
|
29
|
return( $self ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
0
|
1
|
0
|
sub getAttributes { return( wantarray() ? () : [] ); } |
36
|
|
|
|
|
|
|
|
37
|
4
|
50
|
|
4
|
1
|
18
|
sub getChildNodes { return( wantarray() ? () : [] ); } |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
0
|
1
|
0
|
sub getElementById { return; } |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
0
|
1
|
0
|
sub getFirstChild { return; } |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
0
|
1
|
0
|
sub getLastChild { return; } |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
0
|
1
|
0
|
sub getParentNode { return( shift->parent ); } |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
0
|
1
|
0
|
sub getRootNode { return( shift->parent->getRootNode ); } |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
0
|
1
|
0
|
sub getValue { return( shift->value ); } |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub isEqualNode |
52
|
|
|
|
|
|
|
{ |
53
|
0
|
|
|
0
|
1
|
0
|
my $self = shift( @_ ); |
54
|
0
|
|
0
|
|
|
0
|
my $e = shift( @_ ) || return( $self->error( "No html element was provided to insert." ) ); |
55
|
0
|
0
|
|
|
|
0
|
return( $self->error( "Element provided (", overload::StrVal( $e ), ") is not an HTML::Object::Element." ) ) if( !$self->_is_a( $e => 'HTML::Object::Element' ) ); |
56
|
0
|
0
|
|
|
|
0
|
return(0) if( !$self->_is_a( $e => 'HTML::Object::Comment' ) ); |
57
|
0
|
|
|
|
|
0
|
return( $self->value eq $e->value ); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
0
|
1
|
0
|
sub isAttributeNode { return(0); } |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
0
|
1
|
0
|
sub isCommentNode { return(1); } |
63
|
|
|
|
|
|
|
|
64
|
4
|
|
|
4
|
1
|
18
|
sub isElementNode { return(0); } |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
0
|
1
|
0
|
sub isNamespaceNode { return(0); } |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
0
|
1
|
0
|
sub isPINode { return(0); } |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
0
|
1
|
0
|
sub isProcessingInstructionNode { return(0); } |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
0
|
1
|
0
|
sub isTextNode { return(0); } |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# Note: Property |
75
|
2
|
|
|
2
|
1
|
1877
|
sub nodeValue : lvalue { return( shift->_set_get_lvalue( 'value', @_ ) ); } |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
0
|
1
|
|
sub string_value { return( shift->value ); } |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
0
|
1
|
|
sub toString { return( shift->value ); } |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
# NOTE: POD |
83
|
|
|
|
|
|
|
__END__ |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=encoding utf-8 |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 NAME |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
HTML::Object::DOM::Comment - HTML Object DOM Comment Class |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 SYNOPSIS |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
use HTML::Object::DOM::Comment; |
94
|
|
|
|
|
|
|
my $this = HTML::Object::DOM::Comment->new( value => $some_comment ) || |
95
|
|
|
|
|
|
|
die( HTML::Object::DOM::Comment->error, "\n" ); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 VERSION |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
v0.2.0 |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 DESCRIPTION |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
The L<Comment|HTML::Object::DOM::Comment> interface represents textual notations within markup; although it is generally not visually shown, such comments are available to be read in the source view. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Comments are represented in HTML and XML as content between '<!--' and '-->'. In XML, like inside SVG or MathML markup, the character sequence '--' cannot be used within a comment. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
It inherits from L<HTML::Object::Comment> and L<HTML::Object::DOM::CharacterData> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 INHERITANCE |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
+-----------------------+ +---------------------------+ +-------------------------+ +----------------------------------+ +----------------------------+ |
112
|
|
|
|
|
|
|
| HTML::Object::Element | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Node | --> | HTML::Object::DOM::CharacterData | --> | HTML::Object::DOM::Comment | |
113
|
|
|
|
|
|
|
+-----------------------+ +---------------------------+ +-------------------------+ +----------------------------------+ +----------------------------+ |
114
|
|
|
|
|
|
|
| ^ |
115
|
|
|
|
|
|
|
| | |
116
|
|
|
|
|
|
|
v | |
117
|
|
|
|
|
|
|
+-----------------------+ | |
118
|
|
|
|
|
|
|
| HTML::Object::Comment | -----------------------------------------------------------------------------------------------------------------+ |
119
|
|
|
|
|
|
|
+-----------------------+ |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 PROPERTIES |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head2 nodeValue |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Sets or gets the text value for this element. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 METHODS |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 getAttributes |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Returns an empty list in list context, or an empty array reference in scalar context. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 getChildNodes |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Returns an empty list in list context, or an empty array reference in scalar context. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 getElementById |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Returns an empty list in list context, or C<undef> in scalar context. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head2 getFirstChild |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Returns an empty list in list context, or C<undef> in scalar context. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head2 getLastChild |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Returns an empty list in list context, or C<undef> in scalar context. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 getParentNode |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Returns the parent node, if any. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 getRootNode |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Returns the L<root node|HTML::Object::DOM::Document> |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head2 getValue |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Returns the text value of this comment, i.e. the text between C<<!--> and C<-->> |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head2 isAttributeNode |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Returns false. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head2 isCommentNode |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Returns true. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head2 isElementNode |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Returns false. |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head2 isEqualNode |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Provided with another element object, and this returns true if both comment element are the same, or false otherwise. |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head2 isNamespaceNode |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Returns false. |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head2 isPINode |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Returns false. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head2 isProcessingInstructionNode |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
Returns false. |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head2 isTextNode |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Returns false. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head2 string_value |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Returns the content of the comment as a string. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head2 toString |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Returns the content of the comment as a string. |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head1 AUTHOR |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=head1 SEE ALSO |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/Comment> |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
Copyright(c) 2021 DEGUEST Pte. Ltd. |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
All rights reserved |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=cut |