73 |
## TODO: setter |
## TODO: setter |
74 |
|
|
75 |
## TODO: Browser-compatible serializer |
## TODO: Browser-compatible serializer |
76 |
|
## TODO: This code does not work for cases where default namespace |
77 |
|
## has no namespace prefix declared. |
78 |
|
my $self = $_[0]; |
79 |
require Whatpm::CSS::SelectorsSerializer; |
require Whatpm::CSS::SelectorsSerializer; |
80 |
return Whatpm::CSS::SelectorsSerializer->serialize_test |
return Whatpm::CSS::SelectorsSerializer->serialize_selector_text |
81 |
(${$_[0]}->{_selectors}); |
($$self->{_selectors}, sub { |
82 |
|
## TODO: We should have some caching mechanism, otherwise |
83 |
|
## too many computation for complex selectors in long style sheet. |
84 |
|
return $self->parent_style_sheet->manakai_lookup_namespace_prefix |
85 |
|
($_[0]); |
86 |
|
}); |
87 |
} # selector_text |
} # selector_text |
88 |
|
|
89 |
sub style ($) { |
sub style ($) { |
99 |
|
|
100 |
## |CSSRule| attributes |
## |CSSRule| attributes |
101 |
|
|
102 |
## TODO: |css_text| |
sub css_text ($;$) { |
103 |
|
## TODO: setter |
104 |
|
|
105 |
|
## NOTE: It will be broken if |encoding| contains |"| or |\|, but this |
106 |
|
## is what browsers do. |
107 |
|
return '@charset "'.${$_[0]}->{encoding}.'";'; |
108 |
|
} # css_text |
109 |
|
|
110 |
sub type ($) { Message::DOM::CSSRule::CHARSET_RULE } |
sub type ($) { Message::DOM::CSSRule::CHARSET_RULE } |
111 |
|
|
235 |
|
|
236 |
## |CSSRule| attributes |
## |CSSRule| attributes |
237 |
|
|
238 |
## TODO: |css_text| |
sub css_text ($;$) { |
239 |
|
## TODO: Setter |
240 |
|
|
241 |
|
## NOTE: Sometimes ugly, but this is what Firefox does. |
242 |
|
my $prefix = ${$_[0]}->{prefix}; |
243 |
|
return '@namespace '.($prefix ne '' ? $prefix.' ' : ''). |
244 |
|
'url('.${$_[0]}->{namespace_uri}.');'; |
245 |
|
} # css_text |
246 |
|
|
247 |
sub type ($) { Message::DOM::CSSRule::NAMESPACE_RULE } |
sub type ($) { Message::DOM::CSSRule::NAMESPACE_RULE } |
248 |
|
|