| 1 | ##---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 2 | ## HTML Object - ~/lib/HTML/Object/DOM.pm | ||||||||||||||||||||||||||||||||
| 3 | ## Version v0.5.1 | ||||||||||||||||||||||||||||||||
| 4 | ## Copyright(c) 2024 DEGUEST Pte. Ltd. | ||||||||||||||||||||||||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||||||||||||||||||||||||||||||||
| 6 | ## Created 2021/12/13 | ||||||||||||||||||||||||||||||||
| 7 | ## Modified 2026/07/04 | ||||||||||||||||||||||||||||||||
| 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; | ||||||||||||||||||||||||||||||||
| 15 | BEGIN | ||||||||||||||||||||||||||||||||
| 16 | 35 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 17 | 35 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 18 | 35 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 19 | 35 | warnings::register_categories( 'HTML::Object' ); | |||||||||||||||||||||||||||||||
| 20 | 35 | ▶ | use parent qw( HTML::Object ); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 21 | 35 | ▶ | use vars qw( @EXPORT_OK %EXPORT_TAGS $SCREEN $WINDOW $TAG_TO_CLASS $GLOBAL_DOM $VERSION ); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 22 | 35 | ▶ | use HTML::Object::DOM::Closing; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 23 | 35 | ▶ | use HTML::Object::DOM::Comment; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 24 | 35 | ▶ | use HTML::Object::DOM::Declaration; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 25 | 35 | ▶ | use HTML::Object::DOM::Document; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 26 | 35 | ▶ | use HTML::Object::DOM::Element; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 27 | 35 | ▶ | use HTML::Object::DOM::Space; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 28 | 35 | ▶ | use HTML::Object::DOM::Text; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 29 | 35 | ▶ | use HTML::Object::DOM::Screen; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 30 | 35 | ▶ | use HTML::Object::DOM::Window; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 31 | 35 | ▶ | use Scalar::Util (); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 32 | 35 | ▶ | use constant { | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 33 | # For HTML::Object::DOM::Node | ||||||||||||||||||||||||||||||||
| 34 | 35 | DOCUMENT_POSITION_IDENTICAL => 0, | |||||||||||||||||||||||||||||||
| 35 | DOCUMENT_POSITION_DISCONNECTED => 1, | ||||||||||||||||||||||||||||||||
| 36 | DOCUMENT_POSITION_PRECEDING => 2, | ||||||||||||||||||||||||||||||||
| 37 | DOCUMENT_POSITION_FOLLOWING => 4, | ||||||||||||||||||||||||||||||||
| 38 | DOCUMENT_POSITION_CONTAINS => 8, | ||||||||||||||||||||||||||||||||
| 39 | DOCUMENT_POSITION_CONTAINED_BY => 16, | ||||||||||||||||||||||||||||||||
| 40 | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC => 32, | ||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||
| 42 | ELEMENT_NODE => 1, | ||||||||||||||||||||||||||||||||
| 43 | ATTRIBUTE_NODE => 2, | ||||||||||||||||||||||||||||||||
| 44 | TEXT_NODE => 3, | ||||||||||||||||||||||||||||||||
| 45 | CDATA_SECTION_NODE => 4, | ||||||||||||||||||||||||||||||||
| 46 | # Deprecated | ||||||||||||||||||||||||||||||||
| 47 | ENTITY_REFERENCE_NODE => 5, | ||||||||||||||||||||||||||||||||
| 48 | # Deprecated | ||||||||||||||||||||||||||||||||
| 49 | ENTITY_NODE => 6, | ||||||||||||||||||||||||||||||||
| 50 | PROCESSING_INSTRUCTION_NODE => 7, | ||||||||||||||||||||||||||||||||
| 51 | COMMENT_NODE => 8, | ||||||||||||||||||||||||||||||||
| 52 | DOCUMENT_NODE => 9, | ||||||||||||||||||||||||||||||||
| 53 | DOCUMENT_TYPE_NODE => 10, | ||||||||||||||||||||||||||||||||
| 54 | DOCUMENT_FRAGMENT_NODE => 11, | ||||||||||||||||||||||||||||||||
| 55 | NOTATION_NODE => 12, | ||||||||||||||||||||||||||||||||
| 56 | # non-standard addition, because we distinguish space from text | ||||||||||||||||||||||||||||||||
| 57 | SPACE_NODE => 13, | ||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||
| 59 | # For HTML::Object::DOM::Element::Media | ||||||||||||||||||||||||||||||||
| 60 | # There is no data yet. Also, readyState is HAVE_NOTHING. | ||||||||||||||||||||||||||||||||
| 61 | NETWORK_EMPTY => 0, | ||||||||||||||||||||||||||||||||
| 62 | # HTMLMediaElement is active and has selected a resource, but is not using the network. | ||||||||||||||||||||||||||||||||
| 63 | NETWORK_IDLE => 1, | ||||||||||||||||||||||||||||||||
| 64 | # The browser is downloading HTMLMediaElement data. | ||||||||||||||||||||||||||||||||
| 65 | NETWORK_LOADING => 2, | ||||||||||||||||||||||||||||||||
| 66 | # No HTMLMediaElement src found. | ||||||||||||||||||||||||||||||||
| 67 | NETWORK_NO_SOURCE => 3, | ||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||
| 69 | # For HTML::Object::DOM::Element::Track | ||||||||||||||||||||||||||||||||
| 70 | # Indicates that the text track's cues have not been obtained. | ||||||||||||||||||||||||||||||||
| 71 | NONE => 0, | ||||||||||||||||||||||||||||||||
| 72 | # Indicates that the text track is loading and there have been no fatal errors encountered so far. Further cues might still be added to the track by the parser. | ||||||||||||||||||||||||||||||||
| 73 | LOADING => 1, | ||||||||||||||||||||||||||||||||
| 74 | # Indicates that the text track has been loaded with no fatal errors. | ||||||||||||||||||||||||||||||||
| 75 | LOADED => 2, | ||||||||||||||||||||||||||||||||
| 76 | # Indicates that the text track was enabled, but when the user agent attempted to obtain it, this failed in some way. Some or all of the cues are likely missing and will not be obtained. | ||||||||||||||||||||||||||||||||
| 77 | ERROR => 3, | ||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||
| 79 | # For HTML::Object::Event | ||||||||||||||||||||||||||||||||
| 80 | # NONE => 0, | ||||||||||||||||||||||||||||||||
| 81 | CAPTURING_PHASE => 1, | ||||||||||||||||||||||||||||||||
| 82 | AT_TARGET => 2, | ||||||||||||||||||||||||||||||||
| 83 | BUBBLING_PHASE => 3, | ||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||
| 85 | CANCEL_PROPAGATION => 1, | ||||||||||||||||||||||||||||||||
| 86 | CANCEL_IMMEDIATE_PROPAGATION => 2, | ||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||
| 88 | # HTML::Object::DOM::NodeFilter | ||||||||||||||||||||||||||||||||
| 89 | # Shows all nodes. | ||||||||||||||||||||||||||||||||
| 90 | SHOW_ALL => 4294967295, | ||||||||||||||||||||||||||||||||
| 91 | # Shows Element nodes. | ||||||||||||||||||||||||||||||||
| 92 | SHOW_ELEMENT => 1, | ||||||||||||||||||||||||||||||||
| 93 | # Shows attribute Attr nodes. | ||||||||||||||||||||||||||||||||
| 94 | SHOW_ATTRIBUTE => 2, | ||||||||||||||||||||||||||||||||
| 95 | # Shows Text nodes. | ||||||||||||||||||||||||||||||||
| 96 | SHOW_TEXT => 4, | ||||||||||||||||||||||||||||||||
| 97 | # Shows CDATASection nodes. | ||||||||||||||||||||||||||||||||
| 98 | SHOW_CDATA_SECTION => 8, | ||||||||||||||||||||||||||||||||
| 99 | # Legacy, no more used. | ||||||||||||||||||||||||||||||||
| 100 | SHOW_ENTITY_REFERENCE => 16, | ||||||||||||||||||||||||||||||||
| 101 | # Legacy, no more used. | ||||||||||||||||||||||||||||||||
| 102 | SHOW_ENTITY => 32, | ||||||||||||||||||||||||||||||||
| 103 | # Shows ProcessingInstruction nodes. | ||||||||||||||||||||||||||||||||
| 104 | SHOW_PROCESSING_INSTRUCTION => 64, | ||||||||||||||||||||||||||||||||
| 105 | # Shows Comment nodes. | ||||||||||||||||||||||||||||||||
| 106 | SHOW_COMMENT => 128, | ||||||||||||||||||||||||||||||||
| 107 | # Shows Document nodes. | ||||||||||||||||||||||||||||||||
| 108 | SHOW_DOCUMENT => 256, | ||||||||||||||||||||||||||||||||
| 109 | # Shows DocumentType nodes. | ||||||||||||||||||||||||||||||||
| 110 | SHOW_DOCUMENT_TYPE => 512, | ||||||||||||||||||||||||||||||||
| 111 | # Shows DocumentFragment nodes. | ||||||||||||||||||||||||||||||||
| 112 | SHOW_DOCUMENT_FRAGMENT => 1024, | ||||||||||||||||||||||||||||||||
| 113 | # Legacy, no more used. | ||||||||||||||||||||||||||||||||
| 114 | SHOW_NOTATION => 2048, | ||||||||||||||||||||||||||||||||
| 115 | # Show spaces | ||||||||||||||||||||||||||||||||
| 116 | SHOW_SPACE => 4096, | ||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||
| 118 | FILTER_ACCEPT => 1, | ||||||||||||||||||||||||||||||||
| 119 | FILTER_REJECT => 2, | ||||||||||||||||||||||||||||||||
| 120 | FILTER_SKIP => 3, | ||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||
| 122 | # HTML::Object::DOM::XPathResult | ||||||||||||||||||||||||||||||||
| 123 | # A result set containing whatever type naturally results from evaluation of the expression. Note that if the result is a node-set then UNORDERED_NODE_ITERATOR_TYPE is always the resulting type. | ||||||||||||||||||||||||||||||||
| 124 | ANY_TYPE => 0, | ||||||||||||||||||||||||||||||||
| 125 | # A result containing a single number. This is useful for example, in an XPath expression using the count() function. | ||||||||||||||||||||||||||||||||
| 126 | NUMBER_TYPE => 1, | ||||||||||||||||||||||||||||||||
| 127 | # A result containing a single string. | ||||||||||||||||||||||||||||||||
| 128 | STRING_TYPE => 2, | ||||||||||||||||||||||||||||||||
| 129 | # A result containing a single boolean value. This is useful for example, in an XPath expression using the not() function. | ||||||||||||||||||||||||||||||||
| 130 | BOOLEAN_TYPE => 3, | ||||||||||||||||||||||||||||||||
| 131 | # A result node-set containing all the nodes matching the expression. The nodes may not necessarily be in the same order that they appear in the document. | ||||||||||||||||||||||||||||||||
| 132 | UNORDERED_NODE_ITERATOR_TYPE => 4, | ||||||||||||||||||||||||||||||||
| 133 | # A result node-set containing all the nodes matching the expression. The nodes in the result set are in the same order that they appear in the document. | ||||||||||||||||||||||||||||||||
| 134 | ORDERED_NODE_ITERATOR_TYPE => 5, | ||||||||||||||||||||||||||||||||
| 135 | # A result node-set containing snapshots of all the nodes matching the expression. The nodes may not necessarily be in the same order that they appear in the document. | ||||||||||||||||||||||||||||||||
| 136 | UNORDERED_NODE_SNAPSHOT_TYPE => 6, | ||||||||||||||||||||||||||||||||
| 137 | # A result node-set containing snapshots of all the nodes matching the expression. The nodes in the result set are in the same order that they appear in the document. | ||||||||||||||||||||||||||||||||
| 138 | ORDERED_NODE_SNAPSHOT_TYPE => 7, | ||||||||||||||||||||||||||||||||
| 139 | # A result node-set containing any single node that matches the expression. The node is not necessarily the first node in the document that matches the expression. | ||||||||||||||||||||||||||||||||
| 140 | ANY_UNORDERED_NODE_TYPE => 8, | ||||||||||||||||||||||||||||||||
| 141 | # A result node-set containing the first node in the document that matches the expression. | ||||||||||||||||||||||||||||||||
| 142 | FIRST_ORDERED_NODE_TYPE => 9, | ||||||||||||||||||||||||||||||||
| 143 | 35 | }; | |||||||||||||||||||||||||||||||
| 144 | 35 | our @EXPORT_OK = qw( | |||||||||||||||||||||||||||||||
| 145 | screen window | ||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||
| 147 | DOCUMENT_POSITION_IDENTICAL | ||||||||||||||||||||||||||||||||
| 148 | DOCUMENT_POSITION_DISCONNECTED | ||||||||||||||||||||||||||||||||
| 149 | DOCUMENT_POSITION_PRECEDING | ||||||||||||||||||||||||||||||||
| 150 | DOCUMENT_POSITION_FOLLOWING | ||||||||||||||||||||||||||||||||
| 151 | DOCUMENT_POSITION_CONTAINS | ||||||||||||||||||||||||||||||||
| 152 | DOCUMENT_POSITION_CONTAINED_BY | ||||||||||||||||||||||||||||||||
| 153 | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | ||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||
| 155 | ELEMENT_NODE | ||||||||||||||||||||||||||||||||
| 156 | ATTRIBUTE_NODE | ||||||||||||||||||||||||||||||||
| 157 | TEXT_NODE | ||||||||||||||||||||||||||||||||
| 158 | CDATA_SECTION_NODE | ||||||||||||||||||||||||||||||||
| 159 | ENTITY_REFERENCE_NODE | ||||||||||||||||||||||||||||||||
| 160 | ENTITY_NODE | ||||||||||||||||||||||||||||||||
| 161 | PROCESSING_INSTRUCTION_NODE | ||||||||||||||||||||||||||||||||
| 162 | COMMENT_NODE | ||||||||||||||||||||||||||||||||
| 163 | DOCUMENT_NODE | ||||||||||||||||||||||||||||||||
| 164 | DOCUMENT_TYPE_NODE | ||||||||||||||||||||||||||||||||
| 165 | DOCUMENT_FRAGMENT_NODE | ||||||||||||||||||||||||||||||||
| 166 | NOTATION_NODE | ||||||||||||||||||||||||||||||||
| 167 | SPACE_NODE | ||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||
| 169 | NETWORK_EMPTY NETWORK_IDLE NETWORK_LOADING NETWORK_NO_SOURCE | ||||||||||||||||||||||||||||||||
| 170 | NONE LOADING LOADED ERROR | ||||||||||||||||||||||||||||||||
| 171 | CAPTURING_PHASE AT_TARGET BUBBLING_PHASE CANCEL_PROPAGATION CANCEL_IMMEDIATE_PROPAGATION | ||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||
| 173 | SHOW_ALL SHOW_ELEMENT SHOW_ATTRIBUTE SHOW_TEXT SHOW_CDATA_SECTION | ||||||||||||||||||||||||||||||||
| 174 | SHOW_ENTITY_REFERENCE SHOW_ENTITY SHOW_PROCESSING_INSTRUCTION SHOW_COMMENT | ||||||||||||||||||||||||||||||||
| 175 | SHOW_DOCUMENT SHOW_DOCUMENT_TYPE SHOW_DOCUMENT_FRAGMENT SHOW_NOTATION SHOW_SPACE | ||||||||||||||||||||||||||||||||
| 176 | FILTER_ACCEPT FILTER_REJECT FILTER_SKIP | ||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||
| 178 | ANY_TYPE NUMBER_TYPE STRING_TYPE BOOLEAN_TYPE | ||||||||||||||||||||||||||||||||
| 179 | UNORDERED_NODE_ITERATOR_TYPE ORDERED_NODE_ITERATOR_TYPE | ||||||||||||||||||||||||||||||||
| 180 | UNORDERED_NODE_SNAPSHOT_TYPE ORDERED_NODE_SNAPSHOT_TYPE | ||||||||||||||||||||||||||||||||
| 181 | ANY_UNORDERED_NODE_TYPE FIRST_ORDERED_NODE_TYPE | ||||||||||||||||||||||||||||||||
| 182 | ); | ||||||||||||||||||||||||||||||||
| 183 | 35 | our %EXPORT_TAGS = ( | |||||||||||||||||||||||||||||||
| 184 | event => [qw( | ||||||||||||||||||||||||||||||||
| 185 | NONE LOADING LOADED ERROR | ||||||||||||||||||||||||||||||||
| 186 | CAPTURING_PHASE AT_TARGET BUBBLING_PHASE CANCEL_PROPAGATION CANCEL_IMMEDIATE_PROPAGATION | ||||||||||||||||||||||||||||||||
| 187 | )], | ||||||||||||||||||||||||||||||||
| 188 | filter => [qw( | ||||||||||||||||||||||||||||||||
| 189 | SHOW_ALL SHOW_ELEMENT SHOW_ATTRIBUTE SHOW_TEXT SHOW_CDATA_SECTION | ||||||||||||||||||||||||||||||||
| 190 | SHOW_ENTITY_REFERENCE SHOW_ENTITY SHOW_PROCESSING_INSTRUCTION SHOW_COMMENT | ||||||||||||||||||||||||||||||||
| 191 | SHOW_DOCUMENT SHOW_DOCUMENT_TYPE SHOW_DOCUMENT_FRAGMENT SHOW_NOTATION SHOW_SPACE | ||||||||||||||||||||||||||||||||
| 192 | FILTER_ACCEPT FILTER_REJECT FILTER_SKIP | ||||||||||||||||||||||||||||||||
| 193 | )], | ||||||||||||||||||||||||||||||||
| 194 | # HTML::Object::DOM::Element::Media | ||||||||||||||||||||||||||||||||
| 195 | media => [qw( NETWORK_EMPTY NETWORK_IDLE NETWORK_LOADING NETWORK_NO_SOURCE )], | ||||||||||||||||||||||||||||||||
| 196 | # HTML::Object::DOM::Node | ||||||||||||||||||||||||||||||||
| 197 | node => [qw( | ||||||||||||||||||||||||||||||||
| 198 | DOCUMENT_POSITION_IDENTICAL | ||||||||||||||||||||||||||||||||
| 199 | DOCUMENT_POSITION_DISCONNECTED | ||||||||||||||||||||||||||||||||
| 200 | DOCUMENT_POSITION_PRECEDING | ||||||||||||||||||||||||||||||||
| 201 | DOCUMENT_POSITION_FOLLOWING | ||||||||||||||||||||||||||||||||
| 202 | DOCUMENT_POSITION_CONTAINS | ||||||||||||||||||||||||||||||||
| 203 | DOCUMENT_POSITION_CONTAINED_BY | ||||||||||||||||||||||||||||||||
| 204 | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | ||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||
| 206 | ELEMENT_NODE | ||||||||||||||||||||||||||||||||
| 207 | ATTRIBUTE_NODE | ||||||||||||||||||||||||||||||||
| 208 | TEXT_NODE | ||||||||||||||||||||||||||||||||
| 209 | CDATA_SECTION_NODE | ||||||||||||||||||||||||||||||||
| 210 | ENTITY_REFERENCE_NODE | ||||||||||||||||||||||||||||||||
| 211 | ENTITY_NODE | ||||||||||||||||||||||||||||||||
| 212 | PROCESSING_INSTRUCTION_NODE | ||||||||||||||||||||||||||||||||
| 213 | COMMENT_NODE | ||||||||||||||||||||||||||||||||
| 214 | DOCUMENT_NODE | ||||||||||||||||||||||||||||||||
| 215 | DOCUMENT_TYPE_NODE | ||||||||||||||||||||||||||||||||
| 216 | DOCUMENT_FRAGMENT_NODE | ||||||||||||||||||||||||||||||||
| 217 | NOTATION_NODE | ||||||||||||||||||||||||||||||||
| 218 | SPACE_NODE | ||||||||||||||||||||||||||||||||
| 219 | )], | ||||||||||||||||||||||||||||||||
| 220 | track => [qw( NONE LOADING LOADED ERROR )], | ||||||||||||||||||||||||||||||||
| 221 | xpath => [qw( | ||||||||||||||||||||||||||||||||
| 222 | ANY_TYPE NUMBER_TYPE STRING_TYPE BOOLEAN_TYPE | ||||||||||||||||||||||||||||||||
| 223 | UNORDERED_NODE_ITERATOR_TYPE ORDERED_NODE_ITERATOR_TYPE | ||||||||||||||||||||||||||||||||
| 224 | UNORDERED_NODE_SNAPSHOT_TYPE ORDERED_NODE_SNAPSHOT_TYPE | ||||||||||||||||||||||||||||||||
| 225 | ANY_UNORDERED_NODE_TYPE FIRST_ORDERED_NODE_TYPE | ||||||||||||||||||||||||||||||||
| 226 | )], | ||||||||||||||||||||||||||||||||
| 227 | ); | ||||||||||||||||||||||||||||||||
| 228 | 35 | $EXPORT_TAGS{all} = [@EXPORT_OK]; | |||||||||||||||||||||||||||||||
| 229 | 35 | our $SCREEN = HTML::Object::DOM::Screen->new; | |||||||||||||||||||||||||||||||
| 230 | 35 | our $WINDOW; | |||||||||||||||||||||||||||||||
| 231 | # An hash reference map to lowercase HTML tag name to perl class, for those who have special classes, otherwise the fallback is HTML::Object::Element. | ||||||||||||||||||||||||||||||||
| 232 | 35 | our $TAG_TO_CLASS = {}; | |||||||||||||||||||||||||||||||
| 233 | 35 | our $GLOBAL_DOM; | |||||||||||||||||||||||||||||||
| 234 | 35 | our $VERSION = 'v0.5.1'; | |||||||||||||||||||||||||||||||
| 235 | }; | ||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||
| 237 | 35 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 238 | 35 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||
| 240 | { | ||||||||||||||||||||||||||||||||
| 241 | # "If name is applet, bgsound, blink, isindex, keygen, multicol, nextid, or spacer, then return HTMLUnknownElement." | ||||||||||||||||||||||||||||||||
| 242 | # "If name is acronym, basefont, big, center, nobr, noembed, noframes, plaintext, rb, rtc, strike, or tt, then return HTMLElement." | ||||||||||||||||||||||||||||||||
| 243 | # "If name is listing or xmp, then return HTMLPreElement." | ||||||||||||||||||||||||||||||||
| 244 | # <https://html.spec.whatwg.org/multipage/dom.html#htmlunknownelement> | ||||||||||||||||||||||||||||||||
| 245 | 35 | $TAG_TO_CLASS = | |||||||||||||||||||||||||||||||
| 246 | { | ||||||||||||||||||||||||||||||||
| 247 | a => 'HTML::Object::DOM::Element::Anchor', | ||||||||||||||||||||||||||||||||
| 248 | acronym => 'HTML::Object::DOM::Element', | ||||||||||||||||||||||||||||||||
| 249 | # Deprecated | ||||||||||||||||||||||||||||||||
| 250 | applet => 'HTML::Object::DOM::Element::Unknown', | ||||||||||||||||||||||||||||||||
| 251 | area => 'HTML::Object::DOM::Element::Area', | ||||||||||||||||||||||||||||||||
| 252 | audio => 'HTML::Object::DOM::Element::Audio', | ||||||||||||||||||||||||||||||||
| 253 | base => 'HTML::Object::DOM::Element::Base', | ||||||||||||||||||||||||||||||||
| 254 | basefont => 'HTML::Object::DOM::Element', | ||||||||||||||||||||||||||||||||
| 255 | # Deprecated | ||||||||||||||||||||||||||||||||
| 256 | bgsound => 'HTML::Object::DOM::Element::Unknown', | ||||||||||||||||||||||||||||||||
| 257 | big => 'HTML::Object::DOM::Element', | ||||||||||||||||||||||||||||||||
| 258 | # Deprecated | ||||||||||||||||||||||||||||||||
| 259 | blink => 'HTML::Object::DOM::Element::Unknown', | ||||||||||||||||||||||||||||||||
| 260 | blockquote => 'HTML::Object::DOM::Element::Quote', | ||||||||||||||||||||||||||||||||
| 261 | body => 'HTML::Object::DOM::Element::Body', | ||||||||||||||||||||||||||||||||
| 262 | br => 'HTML::Object::DOM::Element::BR', | ||||||||||||||||||||||||||||||||
| 263 | button => 'HTML::Object::DOM::Element::Button', | ||||||||||||||||||||||||||||||||
| 264 | canvas => 'HTML::Object::DOM::Element::Canvas', | ||||||||||||||||||||||||||||||||
| 265 | caption => 'HTML::Object::DOM::Element::TableCaption', | ||||||||||||||||||||||||||||||||
| 266 | center => 'HTML::Object::DOM::Element', | ||||||||||||||||||||||||||||||||
| 267 | col => 'HTML::Object::DOM::Element::TableCol', | ||||||||||||||||||||||||||||||||
| 268 | colgroup => 'HTML::Object::DOM::Element::TableCol', | ||||||||||||||||||||||||||||||||
| 269 | data => 'HTML::Object::DOM::Element::Data', | ||||||||||||||||||||||||||||||||
| 270 | datalist => 'HTML::Object::DOM::Element::DataList', | ||||||||||||||||||||||||||||||||
| 271 | details => 'HTML::Object::DOM::Element::Details', | ||||||||||||||||||||||||||||||||
| 272 | dialog => 'HTML::Object::DOM::Element::Dialog', | ||||||||||||||||||||||||||||||||
| 273 | div => 'HTML::Object::DOM::Element::Div', | ||||||||||||||||||||||||||||||||
| 274 | dl => 'HTML::Object::DOM::Element::DList', | ||||||||||||||||||||||||||||||||
| 275 | # "Firefox implements the HTMLSpanElement interface for this element." | ||||||||||||||||||||||||||||||||
| 276 | # <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dt> | ||||||||||||||||||||||||||||||||
| 277 | dt => 'HTML::Object::DOM::Element::Span', | ||||||||||||||||||||||||||||||||
| 278 | dd => 'HTML::Object::DOM::Element', | ||||||||||||||||||||||||||||||||
| 279 | embed => 'HTML::Object::DOM::Element::Embed', | ||||||||||||||||||||||||||||||||
| 280 | fieldset => 'HTML::Object::DOM::Element::FieldSet', | ||||||||||||||||||||||||||||||||
| 281 | font => 'HTML::Object::DOM::Element::Unknown', | ||||||||||||||||||||||||||||||||
| 282 | form => 'HTML::Object::DOM::Element::Form', | ||||||||||||||||||||||||||||||||
| 283 | frame => 'HTML::Object::DOM::Element::Unknown', | ||||||||||||||||||||||||||||||||
| 284 | frameset => 'HTML::Object::DOM::Element::Unknown', | ||||||||||||||||||||||||||||||||
| 285 | head => 'HTML::Object::DOM::Element::Head', | ||||||||||||||||||||||||||||||||
| 286 | h1 => 'HTML::Object::DOM::Element::Heading', | ||||||||||||||||||||||||||||||||
| 287 | h2 => 'HTML::Object::DOM::Element::Heading', | ||||||||||||||||||||||||||||||||
| 288 | h3 => 'HTML::Object::DOM::Element::Heading', | ||||||||||||||||||||||||||||||||
| 289 | h4 => 'HTML::Object::DOM::Element::Heading', | ||||||||||||||||||||||||||||||||
| 290 | h5 => 'HTML::Object::DOM::Element::Heading', | ||||||||||||||||||||||||||||||||
| 291 | h6 => 'HTML::Object::DOM::Element::Heading', | ||||||||||||||||||||||||||||||||
| 292 | hr => 'HTML::Object::DOM::Element::HR', | ||||||||||||||||||||||||||||||||
| 293 | html => 'HTML::Object::DOM::Element::HTML', | ||||||||||||||||||||||||||||||||
| 294 | iframe => 'HTML::Object::DOM::Element::IFrame', | ||||||||||||||||||||||||||||||||
| 295 | image => 'HTML::Object::DOM::Element::Image', | ||||||||||||||||||||||||||||||||
| 296 | input => 'HTML::Object::DOM::Element::Input', | ||||||||||||||||||||||||||||||||
| 297 | # Deprecated | ||||||||||||||||||||||||||||||||
| 298 | isindex => 'HTML::Object::DOM::Element::Unknown', | ||||||||||||||||||||||||||||||||
| 299 | # Deprecated | ||||||||||||||||||||||||||||||||
| 300 | keygen => 'HTML::Object::DOM::Element::Unknown', | ||||||||||||||||||||||||||||||||
| 301 | label => 'HTML::Object::DOM::Element::Label', | ||||||||||||||||||||||||||||||||
| 302 | legend => 'HTML::Object::DOM::Element::Legend', | ||||||||||||||||||||||||||||||||
| 303 | li => 'HTML::Object::DOM::Element::LI', | ||||||||||||||||||||||||||||||||
| 304 | 'link' => 'HTML::Object::DOM::Element::Link', | ||||||||||||||||||||||||||||||||
| 305 | listing => 'HTML::Object::DOM::Element::Pre', | ||||||||||||||||||||||||||||||||
| 306 | 'map' => 'HTML::Object::DOM::Element::Map', | ||||||||||||||||||||||||||||||||
| 307 | marquee => 'HTML::Object::DOM::Element::Marquee', | ||||||||||||||||||||||||||||||||
| 308 | media => 'HTML::Object::DOM::Element::Media', | ||||||||||||||||||||||||||||||||
| 309 | menu => 'HTML::Object::DOM::Element::Unknown', | ||||||||||||||||||||||||||||||||
| 310 | meta => 'HTML::Object::DOM::Element::Meta', | ||||||||||||||||||||||||||||||||
| 311 | meter => 'HTML::Object::DOM::Element::Meter', | ||||||||||||||||||||||||||||||||
| 312 | mod => 'HTML::Object::DOM::Element::Mod', | ||||||||||||||||||||||||||||||||
| 313 | # Deprecated | ||||||||||||||||||||||||||||||||
| 314 | multicol => 'HTML::Object::DOM::Element::Unknown', | ||||||||||||||||||||||||||||||||
| 315 | # Deprecated | ||||||||||||||||||||||||||||||||
| 316 | nextid => 'HTML::Object::DOM::Element::Unknown', | ||||||||||||||||||||||||||||||||
| 317 | nobr => 'HTML::Object::DOM::Element', | ||||||||||||||||||||||||||||||||
| 318 | noembed => 'HTML::Object::DOM::Element', | ||||||||||||||||||||||||||||||||
| 319 | noframes => 'HTML::Object::DOM::Element', | ||||||||||||||||||||||||||||||||
| 320 | object => 'HTML::Object::DOM::Element::Object', | ||||||||||||||||||||||||||||||||
| 321 | ol => 'HTML::Object::DOM::Element::OList', | ||||||||||||||||||||||||||||||||
| 322 | optgroup => 'HTML::Object::DOM::Element::OptGroup', | ||||||||||||||||||||||||||||||||
| 323 | option => 'HTML::Object::DOM::Element::Option', | ||||||||||||||||||||||||||||||||
| 324 | output => 'HTML::Object::DOM::Element::Output', | ||||||||||||||||||||||||||||||||
| 325 | p => 'HTML::Object::DOM::Element::Paragraph', | ||||||||||||||||||||||||||||||||
| 326 | param => 'HTML::Object::DOM::Element::Param', | ||||||||||||||||||||||||||||||||
| 327 | picture => 'HTML::Object::DOM::Element::Picture', | ||||||||||||||||||||||||||||||||
| 328 | plaintext => 'HTML::Object::DOM::Element', | ||||||||||||||||||||||||||||||||
| 329 | pre => 'HTML::Object::DOM::Element::Pre', | ||||||||||||||||||||||||||||||||
| 330 | progress => 'HTML::Object::DOM::Element::Progress', | ||||||||||||||||||||||||||||||||
| 331 | quote => 'HTML::Object::DOM::Element::Quote', | ||||||||||||||||||||||||||||||||
| 332 | 'q' => 'HTML::Object::DOM::Element::Quote', | ||||||||||||||||||||||||||||||||
| 333 | rb => 'HTML::Object::DOM::Element', | ||||||||||||||||||||||||||||||||
| 334 | rtc => 'HTML::Object::DOM::Element', | ||||||||||||||||||||||||||||||||
| 335 | script => 'HTML::Object::DOM::Element::Script', | ||||||||||||||||||||||||||||||||
| 336 | 'select' => 'HTML::Object::DOM::Element::Select', | ||||||||||||||||||||||||||||||||
| 337 | slot => 'HTML::Object::DOM::Element::Slot', | ||||||||||||||||||||||||||||||||
| 338 | source => 'HTML::Object::DOM::Element::Source', | ||||||||||||||||||||||||||||||||
| 339 | # Deprecated | ||||||||||||||||||||||||||||||||
| 340 | spacert => 'HTML::Object::DOM::Element::Unknown', | ||||||||||||||||||||||||||||||||
| 341 | span => 'HTML::Object::DOM::Element::Span', | ||||||||||||||||||||||||||||||||
| 342 | strike => 'HTML::Object::DOM::Element', | ||||||||||||||||||||||||||||||||
| 343 | style => 'HTML::Object::DOM::Element::Style', | ||||||||||||||||||||||||||||||||
| 344 | table => 'HTML::Object::DOM::Element::Table', | ||||||||||||||||||||||||||||||||
| 345 | td => 'HTML::Object::DOM::Element::TableCell', | ||||||||||||||||||||||||||||||||
| 346 | th => 'HTML::Object::DOM::Element::TableCell', | ||||||||||||||||||||||||||||||||
| 347 | 'tr' => 'HTML::Object::DOM::Element::TableRow', | ||||||||||||||||||||||||||||||||
| 348 | tbody => 'HTML::Object::DOM::Element::TableSection', | ||||||||||||||||||||||||||||||||
| 349 | tfoot => 'HTML::Object::DOM::Element::TableSection', | ||||||||||||||||||||||||||||||||
| 350 | thead => 'HTML::Object::DOM::Element::TableSection', | ||||||||||||||||||||||||||||||||
| 351 | template => 'HTML::Object::DOM::Element::Template', | ||||||||||||||||||||||||||||||||
| 352 | textarea => 'HTML::Object::DOM::Element::TextArea', | ||||||||||||||||||||||||||||||||
| 353 | 'time' => 'HTML::Object::DOM::Element::Time', | ||||||||||||||||||||||||||||||||
| 354 | title => 'HTML::Object::DOM::Element::Title', | ||||||||||||||||||||||||||||||||
| 355 | track => 'HTML::Object::DOM::Element::Track', | ||||||||||||||||||||||||||||||||
| 356 | tt => 'HTML::Object::DOM::Element', | ||||||||||||||||||||||||||||||||
| 357 | video => 'HTML::Object::DOM::Element::Video', | ||||||||||||||||||||||||||||||||
| 358 | xmp => 'HTML::Object::DOM::Element::Pre', | ||||||||||||||||||||||||||||||||
| 359 | }; | ||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||
| 362 | # *import = \&Exporter::import; | ||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||
| 364 | sub init | ||||||||||||||||||||||||||||||||
| 365 | 91 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 366 | 91 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||
| 367 | 91 | $self->{onload} = undef; | |||||||||||||||||||||||||||||||
| 368 | 91 | $self->{onreadystatechange} = undef; | |||||||||||||||||||||||||||||||
| 369 | 91 | $self->{_init_strict_use_sub} = 1; | |||||||||||||||||||||||||||||||
| 370 | 91 | ▶ | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 371 | 91 | my $win = $self->new_window( debug => $self->debug ); | |||||||||||||||||||||||||||||||
| 372 | 91 | $self->window( $win ); | |||||||||||||||||||||||||||||||
| 373 | 91 | return( $self ); | |||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||
| 376 | 2402 | ▶ | sub current_parent { return( shift->_set_get_object_without_init( 'current_parent', 'HTML::Object::DOM::Node', @_ ) ); } | ||||||||||||||||||||||||||||||
|
Subroutine
current_parent: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||
| 378 | 155 | ▶ | sub document { return( shift->_set_get_object( 'document', 'HTML::Object::DOM::Document', @_ ) ); } | ||||||||||||||||||||||||||||||
|
Subroutine
document: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||
| 380 | sub get_definition | ||||||||||||||||||||||||||||||||
| 381 | 412 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
get_definition: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 382 | 412 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||
| 383 | 412 | my $tag = shift( @_ ); | |||||||||||||||||||||||||||||||
| 384 | 412 | ▶ | return( $self->error( "No tag was provided to get its definition." ) ) if( !length( $tag ) ); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 385 | # Just to be sure | ||||||||||||||||||||||||||||||||
| 386 | 412 | $tag = lc( $tag ); | |||||||||||||||||||||||||||||||
| 387 | 412 | ▶ | my $def = $self->SUPER::get_definition( $tag, @_ ) || return( $self->pass_error ); | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->SUPER::get_definition($tag, @_) || (return $self->pass_error)
MC/DC0%0/1
$self->SUPER::get_definition($tag, @_) || (return $self->pass_error)
$self->SUPER::get_definition($tag, @_)
Truth table50%1/2
A
A= $self->SUPER::get_definition($tag, @_)
| |||||||||||||||||||||||||||||||||
| 388 | 412 | ▶ | $def->{class} = $TAG_TO_CLASS->{ $tag } if( CORE::exists( $TAG_TO_CLASS->{ $tag } ) ); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 389 | 412 | return( $def ); | |||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||
| 392 | 5 | ▶ | sub get_dom { return( $GLOBAL_DOM ); } | ||||||||||||||||||||||||||||||
|
Subroutine
get_dom: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||
| 394 | sub new_closing | ||||||||||||||||||||||||||||||||
| 395 | 283 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
new_closing: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 396 | 283 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||
| 397 | 283 | ▶ | my $e = HTML::Object::DOM::Closing->new( @_ ) || | ||||||||||||||||||||||||||||||
|
Condition50%1/2
'HTML::Object::DOM::Closing'->new(@_) || (return $self->pass_error('HTML::Object::DOM::Closing'->error))
MC/DC0%0/1
'HTML::Object::DOM::Closing'->new(@_) || (return $self->pass_error('HTML::Object::DOM::Closing'->error))
'HTML::Object::DOM::Closing'->new(@_)
Truth table50%1/2
A
A= 'HTML::Object::DOM::Closing'->new(@_)
| |||||||||||||||||||||||||||||||||
| 398 | return( $self->pass_error( HTML::Object::DOM::Closing->error ) ); | ||||||||||||||||||||||||||||||||
| 399 | 283 | return( $e ); | |||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||
| 402 | sub new_comment | ||||||||||||||||||||||||||||||||
| 403 | 7 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
new_comment: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 404 | 7 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||
| 405 | 7 | ▶ | my $e = HTML::Object::DOM::Comment->new( @_ ) || | ||||||||||||||||||||||||||||||
|
Condition50%1/2
'HTML::Object::DOM::Comment'->new(@_) || (return $self->pass_error('HTML::Object::DOM::Comment'->error))
MC/DC0%0/1
'HTML::Object::DOM::Comment'->new(@_) || (return $self->pass_error('HTML::Object::DOM::Comment'->error))
'HTML::Object::DOM::Comment'->new(@_)
Truth table50%1/2
A
A= 'HTML::Object::DOM::Comment'->new(@_)
| |||||||||||||||||||||||||||||||||
| 406 | return( $self->pass_error( HTML::Object::DOM::Comment->error ) ); | ||||||||||||||||||||||||||||||||
| 407 | 7 | $e->debug( $self->debug ); | |||||||||||||||||||||||||||||||
| 408 | 7 | return( $e ); | |||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||
| 411 | sub new_declaration | ||||||||||||||||||||||||||||||||
| 412 | 28 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
new_declaration: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 413 | 28 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||
| 414 | 28 | ▶ | my $e = HTML::Object::DOM::Declaration->new( @_ ) || | ||||||||||||||||||||||||||||||
|
Condition50%1/2
'HTML::Object::DOM::Declaration'->new(@_) || (return $self->pass_error('HTML::Object::DOM::Declaration'->error))
MC/DC0%0/1
'HTML::Object::DOM::Declaration'->new(@_) || (return $self->pass_error('HTML::Object::DOM::Declaration'->error))
'HTML::Object::DOM::Declaration'->new(@_)
Truth table50%1/2
A
A= 'HTML::Object::DOM::Declaration'->new(@_)
| |||||||||||||||||||||||||||||||||
| 415 | return( $self->pass_error( HTML::Object::DOM::Declaration->error ) ); | ||||||||||||||||||||||||||||||||
| 416 | 28 | $e->debug( $self->debug ); | |||||||||||||||||||||||||||||||
| 417 | 28 | return( $e ); | |||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||
| 420 | sub new_document | ||||||||||||||||||||||||||||||||
| 421 | 70 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
new_document: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 422 | 70 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||
| 423 | 70 | ▶ | my $e = HTML::Object::DOM::Document->new( @_ ) || | ||||||||||||||||||||||||||||||
|
Condition50%1/2
'HTML::Object::DOM::Document'->new(@_) || (return $self->pass_error('HTML::Object::DOM::Document'->error))
MC/DC0%0/1
'HTML::Object::DOM::Document'->new(@_) || (return $self->pass_error('HTML::Object::DOM::Document'->error))
'HTML::Object::DOM::Document'->new(@_)
Truth table50%1/2
A
A= 'HTML::Object::DOM::Document'->new(@_)
| |||||||||||||||||||||||||||||||||
| 424 | return( $self->pass_error( HTML::Object::DOM::Document->error ) ); | ||||||||||||||||||||||||||||||||
| 425 | 70 | my $win = $self->window; | |||||||||||||||||||||||||||||||
| 426 | 70 | $e->defaultView( $win ); | |||||||||||||||||||||||||||||||
| 427 | 70 | $e->debug( $self->debug ); | |||||||||||||||||||||||||||||||
| 428 | 70 | return( $e ); | |||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||
| 431 | sub new_element | ||||||||||||||||||||||||||||||||
| 432 | 35 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
new_element: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 433 | 35 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||
| 434 | 35 | ▶ | my $e = HTML::Object::DOM::Element->new( @_ ) || | ||||||||||||||||||||||||||||||
|
Condition50%1/2
'HTML::Object::DOM::Element'->new(@_) || (return $self->pass_error('HTML::Object::DOM::Element'->error))
MC/DC0%0/1
'HTML::Object::DOM::Element'->new(@_) || (return $self->pass_error('HTML::Object::DOM::Element'->error))
'HTML::Object::DOM::Element'->new(@_)
Truth table50%1/2
A
A= 'HTML::Object::DOM::Element'->new(@_)
| |||||||||||||||||||||||||||||||||
| 435 | return( $self->pass_error( HTML::Object::DOM::Element->error ) ); | ||||||||||||||||||||||||||||||||
| 436 | 35 | $e->debug( $self->debug ); | |||||||||||||||||||||||||||||||
| 437 | 35 | return( $e ); | |||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||
| 440 | sub new_space | ||||||||||||||||||||||||||||||||
| 441 | 462 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
new_space: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||
| 442 | 462 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||
| 443 | 462 | ▶ | my $e = HTML::Object::DOM::Space->new( @_ ) || | ||||||||||||||||||||||||||||||
|
Condition50%1/2
'HTML::Object::DOM::Space'->new(@_) || (return $self->pass_error('HTML::Object::DOM::Space'->error))
MC/DC0%0/1
'HTML::Object::DOM::Space'->new(@_) || (return $self->pass_error('HTML::Object::DOM::Space'->error))
'HTML::Object::DOM::Space'->new(@_)
Truth table50%1/2
A
A= 'HTML::Object::DOM::Space'->new(@_)
| |||||||||||||||||||||||||||||||||
| 444 | return( $self->pass_error( HTML::Object::DOM::Space->error ) ); | ||||||||||||||||||||||||||||||||
| 445 | 462 | return( $e ); | |||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||
| 448 | sub new_text | ||||||||||||||||||||||||||||||||
| 449 | 132 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
new_text: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 450 | 132 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||
| 451 | 132 | ▶ | my $e = HTML::Object::DOM::Text->new( @_ ) || | ||||||||||||||||||||||||||||||
|
Condition50%1/2
'HTML::Object::DOM::Text'->new(@_) || (return $self->pass_error('HTML::Object::DOM::Text'->error))
MC/DC0%0/1
'HTML::Object::DOM::Text'->new(@_) || (return $self->pass_error('HTML::Object::DOM::Text'->error))
'HTML::Object::DOM::Text'->new(@_)
Truth table50%1/2
A
A= 'HTML::Object::DOM::Text'->new(@_)
| |||||||||||||||||||||||||||||||||
| 452 | return( $self->pass_error( HTML::Object::DOM::Text->error ) ); | ||||||||||||||||||||||||||||||||
| 453 | 132 | $e->debug( $self->debug ); | |||||||||||||||||||||||||||||||
| 454 | 132 | return( $e ); | |||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||
| 457 | sub new_window | ||||||||||||||||||||||||||||||||
| 458 | 91 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
new_window: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 459 | 91 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||
| 460 | 91 | ▶ | my $e = HTML::Object::DOM::Window->new( @_ ) || | ||||||||||||||||||||||||||||||
|
Condition50%1/2
'HTML::Object::DOM::Window'->new(@_) || (return $self->pass_error('HTML::Object::DOM::Window'->error))
MC/DC0%0/1
'HTML::Object::DOM::Window'->new(@_) || (return $self->pass_error('HTML::Object::DOM::Window'->error))
'HTML::Object::DOM::Window'->new(@_)
Truth table50%1/2
A
A= 'HTML::Object::DOM::Window'->new(@_)
| |||||||||||||||||||||||||||||||||
| 461 | return( $self->pass_error( HTML::Object::DOM::Window->error ) ); | ||||||||||||||||||||||||||||||||
| 462 | 91 | $e->screen( $SCREEN ); | |||||||||||||||||||||||||||||||
| 463 | 91 | $e->debug( $self->debug ); | |||||||||||||||||||||||||||||||
| 464 | 91 | ▶ | $WINDOW = $e unless( ref( $WINDOW ) ); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 465 | 91 | return( $e ); | |||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||
| 468 | 68 | ▶ | sub onload : lvalue { return( shift->_set_get_code( 'onload', @_ ) ); } | ||||||||||||||||||||||||||||||
|
Subroutine
onload: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||
| 470 | 66 | ▶ | sub onreadystatechange : lvalue { return( shift->_set_get_code( 'onreadystatechange', @_ ) ); } | ||||||||||||||||||||||||||||||
|
Subroutine
onreadystatechange: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | sub parseFromString { return( shift->parse_data( @_ ) ); } | ||||||||||||||||||||||||||||||
|
Subroutine
parseFromString: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||
| 474 | 0 | ▶ | sub screen { return( $SCREEN ); } | ||||||||||||||||||||||||||||||
|
Subroutine
screen: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||
| 476 | sub set_dom | ||||||||||||||||||||||||||||||||
| 477 | 12 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
set_dom: called CC=5 SCAR=16.5
Pod
documented
| |||||||||||||||||||||||||||||||||
| 478 | 12 | my( $this, $html ) = @_; | |||||||||||||||||||||||||||||||
| 479 | 12 | ▶ | if( defined( $html ) ) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 480 | { | ||||||||||||||||||||||||||||||||
| 481 | 12 | ▶ | if( Scalar::Util::blessed( $html ) && $html->isa( 'HTML::Object::DOM::Document' ) ) | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
builtin::blessed($html) and $html->isa("HTML::Object::DOM::Document")
MC/DC50%1/2
builtin::blessed($html) and $html->isa("HTML::Object::DOM::Document")
builtin::blessed($html)
$html->isa("HTML::Object::DOM::Document")
Truth table66%2/3
A and B
A= builtin::blessed($html)B= $html->isa("HTML::Object::DOM::Document")
| |||||||||||||||||||||||||||||||||
| 482 | { | ||||||||||||||||||||||||||||||||
| 483 | 6 | $GLOBAL_DOM = $html; | |||||||||||||||||||||||||||||||
| 484 | } | ||||||||||||||||||||||||||||||||
| 485 | elsif( CORE::length( $html ) ) | ||||||||||||||||||||||||||||||||
| 486 | { | ||||||||||||||||||||||||||||||||
| 487 | 6 | $GLOBAL_DOM = $this->new->parse( $html ); | |||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||
| 490 | 12 | return( $this ); | |||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||
| 493 | sub window | ||||||||||||||||||||||||||||||||
| 494 | 161 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
window: called CC=5 SCAR=21.6
Pod
documented
| |||||||||||||||||||||||||||||||||
| 495 | 161 | ▶ | if( !scalar( @_ ) ) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 496 | { | ||||||||||||||||||||||||||||||||
| 497 | 0 | return( $WINDOW ); | |||||||||||||||||||||||||||||||
| 498 | } | ||||||||||||||||||||||||||||||||
| 499 | 161 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||
| 500 | 161 | ▶ | if( Scalar::Util::blessed( $self ) ) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 501 | { | ||||||||||||||||||||||||||||||||
| 502 | 161 | ▶ | if( $self->isa( 'HTML::Object::DOM' ) ) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 503 | { | ||||||||||||||||||||||||||||||||
| 504 | 161 | return( $self->_set_get_object( 'window', 'HTML::Object::DOM::Window', @_ ) ); | |||||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||||||
| 506 | else | ||||||||||||||||||||||||||||||||
| 507 | { | ||||||||||||||||||||||||||||||||
| 508 | 0 | ▶ | die( "You cannot call window as a class function and passing it an object other than a HTML::Object::DOM::Window object.\n" ) unless( $self->isa( 'HTML::Object::DOM::Window' ) ); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 509 | 0 | $WINDOW = $self; | |||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||
| 512 | else | ||||||||||||||||||||||||||||||||
| 513 | { | ||||||||||||||||||||||||||||||||
| 514 | 0 | die( "Unknown value (", overload::StrVal( $self ), ") provided to window() called as a HTML::Object::DOM class function\n" ); | |||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||
| 518 | 35 | 1; | |||||||||||||||||||||||||||||||
| 519 | # NOTE: POD | ||||||||||||||||||||||||||||||||
| 520 | __END__ | ||||||||||||||||||||||||||||||||