CSS::D...Import(3pm)
π CSS::DOM::Rule::Import β bestie edition π
okay so this is CSS::DOM::Rule::Import, a Perl module from the User Contributed Perl Documentation shelf, and it's literally the CSS @import rule class for CSS::DOM. yeah. that's the whole vibe. let's get into it π«Ά
β¨ VERSION β¨
Version 0.17 β she's grown, she's thriving, she's stable π
πΈ SYNOPSIS πΈ
here's the whole thing in action, no cap:
use CSS::DOM;
my $import_rule = CSS::DOM->parse(
'@import "print.css" print;',
url_fetcher => sub {
# ... code to get the url in $_[0] ...
}
)->cssRules->[0];
$import_rule->href; # 'print.css'
$import_rule->media; # a CSS::DOM::MediaList (array ref)
$import_rule->styleSheet; # a CSS::DOM object
see how it justβ¦ works? iconic. the url_fetcher sub is where you go get the URL that lands in $_[0], that part's on you bestie π
π¦ DESCRIPTION π¦
So this module implements the CSS @import rules for CSS::DOM. It inherits from CSS::DOM::Rule, and it implements the CSSImportRule DOM interface. So basically: it's the glow-up of an @import statement, wearing the DOM interface as its little outfit β¨
π METHODS π
π href
Returns the @import rule's URL. that's it. that's the method. short queen behavior π
π media
Returns the MediaList associated with the @import rule β or a plain list if you're in list context, because she contains multitudes. This defaults to an empty list. If you wanna set it, you can pass a comma-delimited string to the MediaList's mediaText method. periodt.
π§ styleSheet
This returns the style sheet object, if available. Otherwise it returns an empty list β which happens if url_fetcher is not provided, or if it returns undef. so like, no fetcher, no sheet, no problem, just an empty list and a little bit of sadness π
π SEE ALSO π
CSS::DOMCSS::DOM::RuleCSS::DOM::MediaList
π reminder bestie: ifurl_fetcheris missing (or hands backundef),styleSheetis gonna give you an empty list. that's not a bug, that's the documented behavior. lowkey important, highkey fine.
and that's the page!! written up in the Perl v5.36.0 docs dated 2023-08-02, filed under CSS::D...Import(3pm). mwah, go import something cute π
β¨
π¦ where this page comes from
- debian trixie: libcss-dom-perl 0.17-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcss-dom-perl 0.17-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcss-dom-perl 0.17-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcss-dom-perl 0.17-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms