CSS::D...::Media(3pm)
π CSS::D...::Media(3pm) β like, the whole manual but make it cute
okay bestie, so this is CSS::DOM::Rule::Media β the CSS @media rule class for CSS::DOM. Yes it lives in a file called CSS::D...::Media(3pm) because someone at the terminal decided to abbreviate, and honestly? iconic behaviour. Anyway.
β¨ NAME β¨
CSS::DOM::Rule::Media β the CSS @media rule class for CSS::DOM. That's it, that's the name, she's simple and she serves π
πΈ VERSION πΈ
Version 0.17 β vintage but thriving, no cap.
π¦ SYNOPSIS π¦
okay so here's how you actually use her:
use CSS::DOM;
my $media_rule = CSS::DOM->parse(
'@media print { body { background: none } }'
)->cssRules->[0];
# OR:
use CSS::DOM::Rule::Media;
my $media_rule = new CSS::DOM::Rule::Media $parent;
push @{$media_rule->media}, 'print';
$media_rule->insertRule('body { background: none }')
two whole ways to get your @media rule and both of them eat, fr fr. π
π DESCRIPTION π
This module implements CSS @media rules for CSS::DOM. It inherits from CSS::DOM::Rule and implements the CSSMediaRule DOM interface. So it's giving legacy DOM energy but make it Perl. Inheritance? Slay. Interface? Also slay. β¨
π METHODS π
media
Returns the MediaList associated with the @media rule β or, plot twist, a plain list if you're in list context. This defaults to an empty list btw, so don't come for her if she's quiet at first.
Pro tip from the original text, verbatim energy: you can pass a comma-delimited string to the MediaList's "mediaText" method to set it. Comma-delimited. Yes. That's the move. π«Ά
cssRules
In scalar context, this returns a CSS::DOM::RuleList object β which is literally just a blessed array reference, humble queen β full of CSS::DOM::Rule objects. In list context it returns a list. Context is everything bestie, always has been. π
insertRule ( $css_code, $index )
Parses the rule contained in the $css_code, inserting it into the @media rule's list of subrules at the given $index. So you hand her CSS as a string, you tell her where, and she just... does it. Main character energy. π₯
deleteRule ( $index )
Deletes the rule at the given $index. That's the whole thing. Gone. Not me being emotional about it. π
π SEE ALSO π
the girlies you should also be reading, iykyk:
CSS::DOMCSS::DOM::RuleCSS::DOM::MediaList
π« the sign-off π«
this page is from perl v5.36.0, dated 2023-08-02, and it's filed under CSS::D...::Media(3pm). Consider yourself fully caught up. Go forth and style responsibly, bestie β you ate, periodt. πβ¨π
π¦ 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