1CSS::DOM::Rule(3)     User Contributed Perl Documentation    CSS::DOM::Rule(3)
2
3
4

NAME

6       CSS::DOM::Rule - CSS rule class for CSS::DOM
7

VERSION

9       Version 0.17
10

SYNOPSIS

12         use CSS::DOM::Rule ':all'; # import constants
13
14         use CSS::DOM;
15         $sheet = new CSS::DOM;
16         $sheet->insertRule('bla blah blah {}');
17         $rule = $sheet->cssRules->[0];
18
19         $rule->type; # STYLE_RULE
20         $rule->cssText; # 'bla blah blah {}' or similar
21         $rule->cssText('p { margin: 0 }'); # replace it
22         $rule->parentStyleSheet; # $sheet
23

DESCRIPTION

25       This module provides the CSS rule class for CSS::DOM. It implements the
26       CSSRule and CSSUnknownRule DOM interfaces.
27

METHODS

29   Constructor
30       Only call the constructor on this class to create an 'unknown' rule.
31       You have to call the constructor on a particular subclass to get
32       another type. Normally you do not need to call this directly anyway.
33       (See CSS::DOM's "parse" and "insertRule" methods.) But just in case you
34       do want to call it, here it is:
35
36         new CSS::DOM::Rule $parent; # unknown rule
37
38         require CSS::DOM::Rule::Style
39         new CSS::DOM::Rule::Style $parent;
40         # etc.
41
42       $parent is the parent rule, if the rule is nested, or the parent style
43       sheet otherwise.
44
45   Object Methods
46       type
47           Returns one of the constants below indicating the type of rule.
48
49       cssText
50           Returns this rule's CSS code. If you pass an argument, it will be
51           parsed as the new CSS code for this rule (replacing the existing
52           data), and the old value will be returned. This method will die if
53           the replacement CSS code creates a different type of rule.
54
55       parentStyleSheet
56           This returns the style sheet to which the rule belongs.
57
58       parentRule
59           This returns the rule's parent rule, if there is one, or an empty
60           list otherwise. There is only a parent rule if this one is nested,
61           e.g., inside a media rule.
62

EXPORTS

64       The following constants that indicate the type of rule will be exported
65       on request (individually or with the ':all' tag):
66
67         UNKNOWN_RULE
68         STYLE_RULE
69         CHARSET_RULE
70         IMPORT_RULE
71         MEDIA_RULE
72         FONT_FACE_RULE
73         PAGE_RULE
74

SEE ALSO

76       CSS::DOM
77
78       CSS::DOM::Rule::Style
79
80       CSS::DOM::Rule::Media
81
82       CSS::DOM::Rule::Page
83
84       CSS::DOM::Rule::Import
85
86
87
88perl v5.32.0                      2020-07-28                 CSS::DOM::Rule(3)
Impressum