VERSION

Version 0.15

SYNOPSIS

  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 }')

DESCRIPTION

This module implements \s-1CSS\s0 @media rules for \s-1CSS::DOM\s0. It inherits from CSS::DOM::Rule and implements the CSSMediaRule \s-1DOM\s0 interface.

METHODS

media

Returns the MediaList associated with the @media rule (or a plain list in list context). This defaults to an empty list. You can pass a comma-delimited string to the MediaList's \*(C`mediaText\*(C' method to set it.

cssRules

In scalar context, this returns a CSS::DOM::RuleList object (simply a blessed array reference) of CSS::DOM::Rule objects. In list context it returns a list. Parses the rule contained in the $css_code, inserting it the @media rule's list of subrules at the given $index. Deletes the rule at the given $index.

RELATED TO CSS::DOM::Rule::Media…

\s-1CSS::DOM\s0

CSS::DOM::Rule

CSS::DOM::MediaList