Data types: styles

Represents any combination of styles.

Type syntax

styles

Literal syntax

[style‑name,style‑name, ... ]

[]

Discussion

Operands of this data type can be considered as collections containing none, one or any combination of style members. Each member can be individually included or excluded. The operands are used within multi-variant application to control the variant selection.

The styles literal consists of a sequence of style names enclosed between a pair of [...] (square brackets) and separated by a , (comma) signs. The order of names doesn't matter. Literals with no content (no style names between [ ... ]) are considered as empty styles. The literal can be used within expressions wherever a styles operand is expected. The type name styles, in turn, is designated to be used in declarations of data members. For example:

var styles theSet = [];        // 'theSet' represents an empty styles set

theSet = [ HiRes, DebugMode ]; // 'theSet' contains now the both styles: 
                               // 'HiRes' and 'DebugMode'

In addition to the data type styles, there exists also a homonymous global built-in variable styles that stores the set of currently active styles.

Instant properties

You can test whether a styles operand is empty or not by simply evaluating its instant property isempty.

Instant methods

You can test whether one styles operand is completely contained within another styles operand by using the instant method contains().

Set operations

You can combine two styles operands to expressions. The following table provides an overview of the possible operations:

Operator

Abstract description

+

Union of two styles operands.

-

Difference between two styles operands.

&

Intersection between two styles operands.

Comparison operations

You can compare two styles operands in order to test whether these contain exact the same style names or not. The following table provides an overview of the possible operations:

Operator

Short description

==

Equality test for two styles operands.

!=

Inequality test for two styles operands.