ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
mx.styles 

CSSSelector  - AS3 Flex

Packagemx.styles
Classpublic class CSSSelector
InheritanceCSSSelector Inheritance Object

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

Represents a selector node in a potential chain of selectors used to match CSS style declarations to components.



Public Properties
 PropertyDefined By
  ancestor : CSSSelector
[read-only] If this selector is part of a descendant selector it may have a further selector defined for an arbitrary ancestor.
CSSSelector
  conditions : Array
[read-only] This selector may match a subset of components by specifying further conditions (for example, a matching component must have a particular id, styleName (equivalent to a 'class' condition in CSS) or state (equivalent to a 'pseudo' condition in CSS)).
CSSSelector
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  specificity : int
[read-only] Calculates the specificity of a selector chain in order to determine the precedence when applying several matching style declarations.
CSSSelector
  subject : String
[read-only] The subject of this selector node (only).
CSSSelector
Public Methods
 MethodDefined By
  
CSSSelector(subject:String, conditions:Array = null, ancestor:CSSSelector = null)
Constructor.
CSSSelector
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
  
Determines whether this selector matches the given component.
CSSSelector
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
  
Returns a String representation of this selector.
CSSSelector
 Inherited
Returns the primitive value of the specified object.
Object
Property Detail

ancestor

property
ancestor:CSSSelector  [read-only]

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

If this selector is part of a descendant selector it may have a further selector defined for an arbitrary ancestor.



Implementation
    public function get ancestor():CSSSelector

conditions

property 
conditions:Array  [read-only]

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

This selector may match a subset of components by specifying further conditions (for example, a matching component must have a particular id, styleName (equivalent to a 'class' condition in CSS) or state (equivalent to a 'pseudo' condition in CSS)).

If no conditions are specified, this property is null.



Implementation
    public function get conditions():Array

specificity

property 
specificity:int  [read-only]

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

Calculates the specificity of a selector chain in order to determine the precedence when applying several matching style declarations. Note that id conditions contribute 100 points, pseudo and class conditions each contribute 10 points, types (including descendants in a chain of selectors) contribute 1 point. Universal selectors (") contribute nothing. The result is the sum of these contributions. Selectors with a higher specificity override selectors of lower specificity. If selectors have equal specificity, the declaration order determines the precedence (the last one wins).



Implementation
    public function get specificity():int

subject

property 
subject:String  [read-only]

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

The subject of this selector node (only). To get a String representation of all conditions and descendants of this selector call the toString() method.

If this selector represents the root node of a potential chain of selectors, the subject also represents the subject of the entire selector expression.



Implementation
    public function get subject():String
Constructor Detail

CSSSelector

()Constructor
public function CSSSelector(subject:String, conditions:Array = null, ancestor:CSSSelector = null)

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

Constructor.

Parameters
subject:String — The plain representation of this selector without conditions or ancestors. This is typically a fully-qualified class name; for example, "spark.components.Button". You can use " to match all components or "global" for a global selector.
 
conditions:Array (default = null) — An optional Array of objects of type CSSCondition that is used to match a subset of component instances. Currently only a single or a pair of conditions are supported.
 
ancestor:CSSSelector (default = null) — An optional selector to match on a component that descends from an arbitrary ancestor.
Method Detail

matchesStyleClient

()method
public function matchesStyleClient(object:IAdvancedStyleClient):Boolean

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

Determines whether this selector matches the given component.

Parameters

object:IAdvancedStyleClient — The component to which the selector may apply.

Returns
Boolean — true if component is a match, or false if not.

toString

()method 
public function toString():String

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 10, AIR 1.5

Returns a String representation of this selector.

Returns
String — A String representation of this selector including all of its syntax, conditions and ancestors.