File Coverage

lib/HTML/Object/DOM/WindowProxy.pm
Criterion Covered Total %
statement 22 29 75.8
branch 0 4 0.0
condition n/a
subroutine 8 9 88.8
pod n/a
total 30 42 71.4


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## HTML Object - ~/lib/HTML/Object/DOM/WindowProxy.pm
3             ## Version v0.2.0
4             ## Copyright(c) 2021 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2021/12/31
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::WindowProxy;
15             BEGIN
16             {
17 1     1   1562 use strict;
  1         2  
  1         31  
18 1     1   4 use warnings;
  1         2  
  1         27  
19 1     1   4 use parent qw( HTML::Object::DOM::Window );
  1         2  
  1         5  
20 1     1   84 use vars qw( $VERSION );
  1         2  
  1         53  
21 1     1   7 use HTML::Object::DOM;
  1         3  
  1         9  
22 1     1   20 our $VERSION = 'v0.2.0';
23             };
24              
25 1     1   15 use strict;
  1         3  
  1         24  
26 1     1   5 use warnings;
  1         2  
  1         256  
27              
28             sub AUTOLOAD
29             {
30 0     0     my( $name ) = our $AUTOLOAD =~ /([^:]+)$/;
31 0           my $self = shift( @_ );
32 0           my $win = $HTML::Object::DOM::WINDOW;
33 0           my $code = $win->can( $name );
34 0 0         die( "No method \"\$name\" in class \"", ref( $win ), "\".\n" ) if( !$code );
35 0 0         eval( "sub $name" . ( Window->is_property( $name ) ? ' : lvalue' : '' ) . " { return( \$HTML::Object::DOM::WINDOW->$name( \@_ ) ); }\n\n" );
36 0           return( $code->( $win, @_ ) );
37             }
38              
39             1;
40             # NOTE: POD
41             __END__
42              
43             =encoding utf-8
44              
45             =head1 NAME
46              
47             HTML::Object::DOM::WindowProxy - HTML Object DOM WindowProxy Class
48              
49             =head1 SYNOPSIS
50              
51             use HTML::Object::DOM::WindowProxy;
52             my $proxy = HTML::Object::DOM::WindowProxy->new ||
53             die( HTML::Object::DOM::WindowProxy->error, "\n" );
54              
55             =head1 VERSION
56              
57             v0.2.0
58              
59             =head1 DESCRIPTION
60              
61             This interface implements a C<WindowProxy>. It is a wrapper around L<HTML::Object::DOM::Window>, but does not inherit from it.
62              
63             This does not do any specific otherwise, other than existing.
64              
65             Under JavaScript, a C<WindowProxy> object is a wrapper for a L<Window|HTML::Object::DOM::Window> object. A C<WindowProxy> object exists in every browsing context. All operations performed on a C<WindowProxy> object will also be applied to the underlying L<Window|HTML::Object::DOM::Window> object it currently wraps. Therefore, interacting with a WindowProxy object is almost identical to directly interacting with a Window object. When a browsing context is navigated, the Window object its WindowProxy wraps is changed.
66              
67             =head1 INHERITANCE
68              
69             +-----------------------+ +---------------------------+ +---------------------------+
70             | HTML::Object::Element | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Window |
71             +-----------------------+ +---------------------------+ +---------------------------+
72              
73             =head1 PROPERTIES
74              
75             All properties are redirecting to those in L<HTML::Object::DOM::Window>
76              
77             =head1 METHODS
78              
79             All methods are redirecting to those in L<HTML::Object::DOM::Window>
80              
81             =head1 EVENTS & EVENT LISTENERS
82              
83             All events and event listeners are redirecting to those in L<HTML::Object::DOM::Window>
84              
85             =head1 AUTHOR
86              
87             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
88              
89             =head1 SEE ALSO
90              
91             L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Glossary/WindowProxy>, L<StackOverlow about WindowProxy|https://stackoverflow.com/questions/16092835/windowproxy-and-window-objects>
92              
93             =head1 COPYRIGHT & LICENSE
94              
95             Copyright(c) 2021 DEGUEST Pte. Ltd.
96              
97             All rights reserved
98              
99             This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
100              
101             =cut