117 |
push our @ISA, 'Message::DOM::CSSRule', 'Message::IF::CSSImportRule'; |
push our @ISA, 'Message::DOM::CSSRule', 'Message::IF::CSSImportRule'; |
118 |
|
|
119 |
sub ____new ($$$$) { |
sub ____new ($$$$) { |
120 |
my $self = bless \{href => $_[1], media => $_[2], style_sheet => $_[3]}, $_[0]; |
my $self = bless \{href => $_[1], media => \$_[2], |
121 |
|
style_sheet => $_[3]}, $_[0]; |
122 |
|
require Message::DOM::MediaList; |
123 |
|
bless $$self->{media}, 'Message::DOM::MediaList'; |
124 |
${$_[3]}->{owner_rule} = $self; |
${$_[3]}->{owner_rule} = $self; |
125 |
Scalar::Util::weaken (${$_[3]}->{owner_rule}); |
Scalar::Util::weaken (${$_[3]}->{owner_rule}); |
126 |
return $self; |
return $self; |
150 |
push our @ISA, 'Message::DOM::CSSRule', 'Message::IF::CSSMediaRule'; |
push our @ISA, 'Message::DOM::CSSRule', 'Message::IF::CSSMediaRule'; |
151 |
|
|
152 |
sub ____new ($$$) { |
sub ____new ($$$) { |
153 |
my $self = bless \{media => $_[1], css_rules => $_[2]}, $_[0]; |
my $self = bless \{media => \$_[1], css_rules => $_[2]}, $_[0]; |
154 |
|
require Message::DOM::MediaList; |
155 |
|
bless $$self->{media}, 'Message::DOM::MediaList'; |
156 |
for (@{$_[2]}) { |
for (@{$_[2]}) { |
157 |
${$_}->{parent_rule} = $self; |
${$_}->{parent_rule} = $self; |
158 |
Scalar::Util::weaken (${$_}->{parent_rule}); |
Scalar::Util::weaken (${$_}->{parent_rule}); |
162 |
|
|
163 |
## |CSSRule| attributes |
## |CSSRule| attributes |
164 |
|
|
165 |
## TODO: |css_text| |
sub css_text ($;$) { |
166 |
|
## TODO: setter |
167 |
|
my $v = '@media ' . $_[0]->media . " {\n"; |
168 |
|
for (@{${$_[0]}->{css_rules}}) { |
169 |
|
$v .= $_->css_text . "\n"; |
170 |
|
## BUG: Browsers do indent. |
171 |
|
} |
172 |
|
$v .= "}"; |
173 |
|
return $v; |
174 |
|
} # css_text |
175 |
|
|
176 |
sub type ($) { Message::DOM::CSSRule::MEDIA_RULE } |
sub type ($) { Message::DOM::CSSRule::MEDIA_RULE } |
177 |
|
|