2 |
use strict; |
use strict; |
3 |
our $VERSION=do{my @r=(q$Revision$=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
our $VERSION=do{my @r=(q$Revision$=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
4 |
push our @ISA, 'Message::IF::CSSStyleSheet'; |
push our @ISA, 'Message::IF::CSSStyleSheet'; |
5 |
|
require Message::DOM::DOMException; |
6 |
|
require Scalar::Util; |
7 |
|
|
8 |
sub new ($) { |
sub new ($;%) { |
9 |
return bless \{css_rules => []}, shift; |
my $class = shift; |
10 |
|
my $self = bless \{@_}, $class; |
11 |
|
for (@{$$self->{css_rules}}) { |
12 |
|
${$_}->{parent_style_sheet} = $self; |
13 |
|
Scalar::Util::weaken (${$_}->{parent_style_sheet}); |
14 |
|
} |
15 |
|
return $self; |
16 |
} # new |
} # new |
17 |
|
|
18 |
sub AUTOLOAD { |
sub AUTOLOAD { |
56 |
|
|
57 |
sub href ($); |
sub href ($); |
58 |
|
|
59 |
## TODO: media |
sub media ($;$) { |
60 |
|
if (@_ > 1) { |
61 |
|
local $Error::Depth = $Error::Depth + 1; |
62 |
|
${+shift}->{media}->media_text (@_); |
63 |
|
} |
64 |
|
return ${$_[0]}->{media}; |
65 |
|
} # media |
66 |
|
|
67 |
sub owner_node ($); |
sub owner_node ($); |
68 |
|
|
92 |
|
|
93 |
## |CSSStyleSheet| methods |
## |CSSStyleSheet| methods |
94 |
|
|
95 |
## TODO: delete_rule |
sub delete_rule ($$) { |
96 |
|
if ($_[1] < 0 or $_[1] > @{${$_[0]}->{css_rules}}) { |
97 |
|
report Message::DOM::DOMException |
98 |
|
-object => $_[0], |
99 |
|
-type => 'INDEX_SIZE_ERR', |
100 |
|
-subtype => 'INDEX_OUT_OF_BOUND_ERR'; |
101 |
|
} else { |
102 |
|
my $rule = ${$_[0]}->{css_rules}->[$_[1]]; |
103 |
|
delete $rule->{parent_rule}; |
104 |
|
delete ${$_[0]}->{css_rules}->[$_[1]]; |
105 |
|
} |
106 |
|
} # delete_rule |
107 |
|
|
108 |
## TODO: insert_rule |
## TODO: insert_rule |
109 |
|
|