GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
CSS::DOM::Rule(3) User Contributed Perl Documentation CSS::DOM::Rule(3)

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

Version 0.17

  use CSS::DOM::Rule ':all'; # import constants

  use CSS::DOM;
  $sheet = new CSS::DOM;
  $sheet->insertRule('bla blah blah {}');
  $rule = $sheet->cssRules->[0];
  
  $rule->type; # STYLE_RULE
  $rule->cssText; # 'bla blah blah {}' or similar
  $rule->cssText('p { margin: 0 }'); # replace it
  $rule->parentStyleSheet; # $sheet

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

Only call the constructor on this class to create an 'unknown' rule. You have to call the constructor on a particular subclass to get another type. Normally you do not need to call this directly anyway. (See CSS::DOM's "parse" and "insertRule" methods.) But just in case you do want to call it, here it is:

  new CSS::DOM::Rule $parent; # unknown rule
  
  require CSS::DOM::Rule::Style
  new CSS::DOM::Rule::Style $parent;
  # etc.

$parent is the parent rule, if the rule is nested, or the parent style sheet otherwise.

type
Returns one of the constants below indicating the type of rule.
cssText
Returns this rule's CSS code. If you pass an argument, it will be parsed as the new CSS code for this rule (replacing the existing data), and the old value will be returned. This method will die if the replacement CSS code creates a different type of rule.
parentStyleSheet
This returns the style sheet to which the rule belongs.
parentRule
This returns the rule's parent rule, if there is one, or an empty list otherwise. There is only a parent rule if this one is nested, e.g., inside a media rule.

The following constants that indicate the type of rule will be exported on request (individually or with the ':all' tag):

  UNKNOWN_RULE
  STYLE_RULE    
  CHARSET_RULE  
  IMPORT_RULE   
  MEDIA_RULE    
  FONT_FACE_RULE
  PAGE_RULE

CSS::DOM

CSS::DOM::Rule::Style

CSS::DOM::Rule::Media

CSS::DOM::Rule::Page

CSS::DOM::Rule::Import

2018-01-29 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.