JavaScript Reference

Local Navigation

CSS and stylesheets API

Object

Description

Availability

Counter

Represents any counter or counters function value.

4.6 or later

CSSCharsetRule

Represents an @charset rule, which holds an encoding definition.

4.6 or later

CSSFontFaceRule

Represents an @font-face rule, which holds a set of font descriptions.

4.6 or later

CSSImportRule

Represents an @import rule, which imports style rules from other style sheets.

4.6 or later

CSSMediaRule

Represents an @media rule, which defines style rules for a specific media type.

4.6 or later

CSSPageRule

Represents a @page rule, which specifies the dimensions, orientation, and margins for paged media.

4.6 or later

CSSPrimitiveValue

Represents a single CSS value.

4.6 or later

CSSRule

The base class that defines any rule in a CSS style sheet, including rule sets and @ rules.

4.6 or later

CSSRuleList

Represents an ordered collection of CSSRule objects.

4.6 or later

CSSStyleDeclaration

Represents a CSS declaration block that consists of CSS properties and their values.

4.6 or later

CSSStyleRule

Represents a single rule set in a CSS style sheet.

4.6 or later

CSSStyleSheet

Represents a CSS style sheet.

4.6 or later

CSSUnknownValue

Represents an unsupported @ rule.

4.6 or later

CSSValue

Represents a simple or complex CSS property value.

4.6 or later

CSSValueList

Represents an ordered collection of CSSValue objects.

4.6 or later

MediaList

Represents an ordered collection of media. An empty list is equivalent to a list that contains a value of all.

4.6 or later

Rect

Represents a Rect value.

4.6 or later

RGBColor

Represents an RGB color value.

4.6 or later

Stylesheet

Represents a single external or inline style sheet that is associated with a document.

4.6 or later

StylesheetList

Represents an ordered collection of StyleSheet objects.

4.6 or later

Object: Counter

Availability

BlackBerry Device Software version 4.6 or later

The Counter interface is used to represent any counter or counters function value.

Back To Top

Counter properties

Property name

Type

Description

Status

Support level

Availability

identifier

DOMString

Returns the identifier of the counter.

read only

DOM 2 Style

4.6 or later

listStyle

DOMString

Returns the style of the list.

read only

DOM 2 Style

4.6 or later

separator

DOMString

Returns the string used to separate nested counters.

read only

DOM 2 Style

4.6 or later

Back To Top

Object: CSSCharsetRule

Availability

BlackBerry Device Software version 4.6 or later

Extends

CSSRule

The CSSCharsetRule object represents an @charset rule in a CSS style sheet. The @charset rule holds an encoding definition.

The value of the encoding property does not affect the encoding of text data in the DOM objects; this encoding is always UTF-16. After a style sheet is loaded, the value of the encoding property is the value found in the @charset rule. If there was no @charset in the original document, then no CSSCharsetRule object is created. The value of the encoding property may also be used as a hint for the encoding used on serialization of the style sheet.

The value of the @charset rule (and therefore of the CSSCharsetRule object) may not correspond to the encoding the document actually came in; character encoding information, for example, in an HTTP header, has priority but this is not reflected in the CSSCharsetRule.

Back To Top

CSSCharsetRule properties

Property name

Type

Description

Status

Support level

Availability

encoding

DOMString

Specifies the encoding used in this @charset rule.

writable

DOM 2 Style

4.6 or later

Back To Top

Object: CSSFontFaceRule

Availability

BlackBerry Device Software version 4.6 or later

Extends

CSSRule

The CSSFontFaceRule interface represents an @font-face rule in a CSS style sheet. The @font-face rule is used to hold a set of font descriptions.

Back To Top

CSSFontFaceRule properties

Property name

Type

Description

Status

Support level

Availability

style

CSSStyleDeclaration

Returns the declaration block for this rule.

read only

DOM 2 Style

4.6 or later

Back To Top

Object: CSSImportRule

Availability

BlackBerry Device Software version 4.6 or later

Extends

CSSRule

The CSSImportRule interface represents an @import rule within a CSS style sheet. The @import rule is used to import style rules from other style sheets.

Back To Top

CSSImportRule properties

Property name

Type

Description

Status

Support level

Availability

href

DOMString

Returns the location of the style sheet to be imported. The attribute does not contain the "url(...)" specifier around the URI.

read only

DOM 2 Style

4.6 or later

media

MediaList

Returns a list of media types that this style sheet can be used with.

read only

DOM 2 Style

4.6 or later

styleSheet

CSSStyleSheet

Returns the CSSStyleSheet object referred to by this rule, if it has been loaded.

read only

DOM 2 Style

4.6 or later

Back To Top

Object: CSSMediaRule

Availability

BlackBerry Device Software version 4.6 or later

Extends

CSSRule

The CSSMediaRule interface represents an @media rule in a CSS style sheet. The @media rule is used to delimit style rules for specific media types.

Back To Top

CSSMediaRule properties

Property name

Type

Description

Status

Support level

Availability

CSSRules

CSSRuleList

Returns a list of the CSS rules contained within a media block.

read only

DOM 2 Style

4.6 or later

media

MediaList

Returns a list of media types that this style sheet can be used with.

read only

DOM 2 Style

4.6 or later

Back To Top

CSSMediaRule methods

Method name

Description

Support level

Availability

deleteRule()

Removes a rule from the media block.

DOM 2 Style

4.6 or later

insertRule()

Adds a rule to the media block.

DOM 2 Style

4.6 or later

Back To Top

Object: CSSPageRule

Availability

BlackBerry Device Software version 4.6 or later

Extends

CSSRule

The CSSPageRule interface represents a @page rule within a CSS style sheet. The @page rule is used to specify the dimensions, orientation, margins, for paged media.

Back To Top

CSSPageRule properties

Property name

Type

Description

Status

Support level

Availability

selectorText

DOMString

Specifies the page selector for the rule.

writable

DOM 2 Style

4.6 or later

style

CSSStyleDeclaration

Returns the declaration block of the rule.

read only

DOM 2 Style

4.6 or later

Back To Top

Object: CSSPrimitiveValue

Availability

BlackBerry Device Software version 4.6 or later

Extends

CSSValue

The CSSPrimitiveValue object represents a single CSS value. A CSSPrimitiveValue object only occurs in the context of a CSS property.

This object has methods to determine the current value of a specific style property, or to explicitly set a style property. Conversions are allowed between absolute values (from millimeters to centimeters, from degrees to radians, and so on) but not between relative values. For example, a pixel value cannot be converted to a centimeter value. With the exception of values representing colors, percentage values can not be converted, since they are relative to another value.

Because a color percentage value is relative to a known range (0 to 255), however, a color percentage value can be converted to a number.

Back To Top

CSSPrimitiveValue constants

Constant

Value type

Description

Support level

Availability

0

CSS_UNKNOWN

An unrecognized unit type.

DOM 2 Style

4.6 or later

1

CSS_NUMBER

A simple number value.

DOM 2 Style

4.6 or later

2

CSS_PERCENTAGE

A percentage value.

DOM 2 Style

4.6 or later

3

CSS_EMS

A length value, based on font size.

DOM 2 Style

4.6 or later

4

CSS_EXS

A length value, based on font x-height.

DOM 2 Style

4.6 or later

5

CSS_PX

A length value, in pixels.

DOM 2 Style

4.6 or later

6

CSS_CM

A length value, in centimeters.

DOM 2 Style

4.6 or later

7

CSS_MM

A length value, in millimeters.

DOM 2 Style

4.6 or later

8

CSS_IN

A length value, in inches.

DOM 2 Style

4.6 or later

9

CSS_PT

A length value, in points.

DOM 2 Style

4.6 or later

10

CSS_PC

A length value, in picas.

DOM 2 Style

4.6 or later

11

CSS_DEG

An angle value, in degrees.

DOM 2 Style

4.6 or later

12

CSS_RAD

An angle value, in radians.

DOM 2 Style

4.6 or later

13

CSS_GRAD

An angle value, in grads.

DOM 2 Style

4.6 or later

14

CSS_MS

A time value, in milliseconds.

DOM 2 Style

4.6 or later

15

CSS_S

A time value, in seconds.

DOM 2 Style

4.6 or later

16

CSS_HZ

A frequency value, in Hertz.

DOM 2 Style

4.6 or later

17

CSS_KHZ

A frequency, in kiloHertz.

DOM 2 Style

4.6 or later

18

CSS_DIMENSION

A number value of an unknown dimension.

DOM 2 Style

4.6 or later

19

CSS_STRING

A simple string value.

DOM 2 Style

4.6 or later

20

CSS_URI

A string value representing a URI.

DOM 2 Style

4.6 or later

21

CSS_IDENT

A string value representing an identifier.

DOM 2 Style

4.6 or later

22

CSS_ATTR

A string value representing an attribute function.

DOM 2 Style

4.6 or later

23

CSS_COUNTER

A counter or counters function.

DOM 2 Style

4.6 or later

24

CSS_RECT

A Rect function.

DOM 2 Style

4.6 or later

25

CSS_RGBCOLOR

An RGBColor function.

DOM 2 Style

4.6 or later

Back To Top

CSSPrimitiveValue properties

Property name

Type

Description

Status

Support level

Availability

primitiveType

unsigned short

Returns the unit type of a value, represented using a CSSPrimitiveValue constant.

read only

DOM 2 Style

4.6 or later

Back To Top

CSSPrimitiveValue methods

Method name

Description

Support level

Availability

getCounterValue()

Retrieves a Counter value.

DOM 2 Style

4.6 or later

getFloatValue()

Retrieves a float value.

DOM 2 Style

4.6 or later

getRectValue()

Retrieves a Rect value.

DOM 2 Style

4.6 or later

getRGBColorValue()

Retrieves an RGBColor value.

DOM 2 Style

4.6 or later

getStringValue()

Retrieves a string value.

DOM 2 Style

4.6 or later

setFloatValue()

Sets a float value with the specified unit.

DOM 2 Style

4.6 or later

setStringValue()

Sets a string value with the specified unit.

DOM 2 Style

4.6 or later

Back To Top

Object: CSSRuleList

Availability

BlackBerry Device Software version 4.6 or later

The CSSRuleList object represents an ordered collection of CSSRule objects.

Back To Top

CSSRuleList properties

Property name

Type

Description

Status

Support level

Availability

length

int

Returns the number of rules in the list.

read only

DOM 2 Style

4.6 or later

Back To Top

CSSRuleList methods

Method name

Description

Support level

Availability

item()

Returns the rule at the specified index in the collection.

DOM 2 Style

4.6 or later

Back To Top

Object: CSSRule

Availability

BlackBerry Device Software version 4.6 or later

Extended by

CSSCharsetRule, CSSFontFaceRule, CSSImportRule, CSSMediaRule, CSSPageRule, CSSStyleRule, CSSUnknownRule

The CSSRule object is the base class used to define any rule in a CSS Style sheet, including both rule sets and @ rules.

Back To Top

CSSRule constants

Constant

Value type

Description

Support level

Availability

0

UNKNOWN_RULE

A CSSUnknownRule.

DOM 2 Style

4.6 or later

1

STYLE_RULE

A CSSStyleRule.

DOM 2 Style

4.6 or later

2

CHARSET_RULE

A CSSCharsetRule.

DOM 2 Style

4.6 or later

3

IMPORT_RULE

A CSSImportRule.

DOM 2 Style

4.6 or later

4

MEDIA_RULE

A CSSMediaRule.

DOM 2 Style

4.6 or later

5

FONT_FACE_RULE

A CSSFontFaceRule.

DOM 2 Style

4.6 or later

6

PAGE_RULE

A CSSPageRule.

DOM 2 Style

4.6 or later

Back To Top

CSSRule properties

Property name

Type

Description

Status

Support level

Availability

parentRule

CSSRule

Returns the parent rule, if this rule is contained within another rule (for example, a style rule within an @media block).

read only

DOM 2 Style

4.6 or later

parentStyleSheet

CSSStyleSheet

Returns the style sheet that contains this rule.

read only

DOM 2 Style

4.6 or later

type

unsigned short

Returns the type of rule, represented using a CSSRule constant.

read only

DOM 2 Style

4.6 or later

Back To Top

Object: CSSStyleDeclaration

Availability

BlackBerry Device Software version 4.6 or later

The CSSStyleDeclaration object represents a CSS declaration block consisting of CSS properties and their values. This object enables you to determine the style properties currently set in a block or to set style properties explicitly within the block.

This object also provides access to the computed values of an element. It does not provide access to the specified or actual values of the CSS cascade.

Back To Top

CSSStyleDeclaration properties

Property name

Type

Description

Status

Support level

Availability

cssText

DOMString

Specifies the name of the CSS selector for the rule set.

writable

DOM 2 Style

4.6 or later

length

int

Returns the number of properties that have been explicitly set.

read only

DOM 2 Style

4.6 or later

parentRule

CSSRule

Returns the CSSRule that contains this declaration block.

read only

DOM 2 Style

4.6 or later

Back To Top

CSSStyleDeclaration methods

Method name

Description

Support level

Availability

getPropertyCSSValue()

Returns the value of a CSS property as an object, if the property has been explicitly set.

DOM 2 Style

4.6 or later

getPropertyPriority()

Returns the priority of a CSS property.

DOM 2 Style

4.6 or later

getPropertyValue()

Returns the value of a CSS property as a string, if the property has been explicitly set.

DOM 2 Style

4.6 or later

item()

Returns the name of the CSS property at the specified index in the collection.

DOM 2 Style

4.6 or later

removeProperty()

Removes a CSS property from the style declaration block.

DOM 2 Style

4.6 or later

setProperty()

Sets the value of a CSS property for the style declaration block.

DOM 2 Style

4.6 or later

Back To Top

Object: CSSStyleRule

Availability

BlackBerry Device Software version 4.6 or later

Extends

CSSRule

The CSSStyleRule object represents a single rule set in a CSS style sheet.

Back To Top

CSSStyleRule properties

Property name

Type

Description

Status

Support level

Availability

selectorText

DOMString

Specifies the name of the CSS selector for the rule set.

writable

DOM 2 Style

4.6 or later

style

CSSStyleDeclaration

Returns the style values for the CSS selector.

read only

DOM 2 Style

4.6 or later

Back To Top

Object: CSSStyleSheet

Availability

BlackBerry Device Software version 4.6 or later

Extends

StyleSheet

The CSSStyleSheet object represents a CSS style sheet.

Back To Top

CSSStyleSheet methods

Method name

Description

Support level

Availability

deleteRule()

Deletes a rule from the CSS style sheet.

DOM 2 Style

4.6 or later

insertRule()

Adds a new rule to the CSS style sheet.

DOM 2 Style

4.6 or later

Back To Top

CSSStyleSheet properties

Property name

Type

Description

Status

Support level

Availability

CSSRules

CSSRuleList

Returns a list of all CSS rules contained within the style sheet. This includes both rule sets and at-rules.

read only

DOM 2 Style

4.6 or later

ownerRule

CSSRule

Returns the CSSImportRule object for imported style sheets. If the style sheet is not imported, the value for this property is null.

read only

DOM 2 Style

4.6 or later

Back To Top

Object: CSSUnknownRule

Availability

BlackBerry Device Software version 4.6 or later

Extends

CSSRule

The CSSUnknownRule represents an unsupported @ rule.

Back To Top

Object: CSSValue

Availability

BlackBerry Device Software version 4.6 or later

Extended by

CSSPrimitiveValue, CSSValueList

The CSSValue object represents a simple or a complex CSS property value.

Back To Top

CSSValue constants

Constant

Value type

Description

Support level

Availability

0

CSS_INHERIT

An inherited value.

DOM 2 Style

4.6 or later

1

CSS_PRIMITIVE

A CSSPrimitiveValue.

DOM 2 Style

4.6 or later

2

CSS_VALUE_LIST

A CSSValueList.

DOM 2 Style

4.6 or later

3

CSS_CUSTOM

A custom value.

DOM 2 Style

4.6 or later

Back To Top

CSSValue properties

Property name

Type

Description

Status

Support level

Availability

CSSValueType

unsigned short

Returns the type of value, represented using a CSSValue constant.

read only

DOM 2 Style

4.6 or later

Back To Top

Object: CSSValueList

Availability

BlackBerry Device Software version 4.6 or later

Extends

CSSValue

The CSSValueList objects represents an ordered collection of CSSValue objects.

Some properties allow an empty list into their syntax. In that case, these properties take the none identifier. So, an empty list means that the property has the value none.

Back To Top

CSSValueList methods

Method name

Description

Support level

Availability

item()

Returns the CSSValue object by ordinal index .

DOM 2 Style

4.6 or later

Back To Top

CSSValueList properties

Property name

Type

Description

Status

Support level

Availability

length

int

Returns the number of property values in the list.

read only

DOM 2 Style

4.6 or later

Back To Top

Object: MediaList

Availability

BlackBerry Device Software version 4.6 or later

The MediaList object represents an ordered collection of media. An empty list is equivalent to a list that contains a value of all.

Back To Top

MediaList properties

Property name

Type

Description

Status

Support level

Availability

length

int

Returns the number of media in the list.

read only

DOM 2 Style

4.6 or later

mediaText

DOMString

Specifies a comma-separated list of media.

writable

DOM 2 Style

4.6 or later

Back To Top

MediaList methods

Method name

Description

Support level

Availability

appendMedium()

Adds the given medium to the end of the MediaList object.

DOM 2 Style

4.6 or later

deleteMedium()

Removes the given medium from the MediaList object.

DOM 2 Style

4.6 or later

item()

Returns the medium at the given index in the collection.

DOM 2 Style

4.6 or later

Back To Top

Object: Rect

Availability

BlackBerry Device Software version 4.6 or later

The Rect object represents a Rect value.

The Rect object contains four properties, each of which defines a style for the side of a rectangle.

Back To Top

Rect properties

Property name

Type

Description

Status

Support level

Availability

bottom

String

Returns the style for the bottom of the Rect.

read only

DOM 2 Style

4.6 or later

left

String

Returns the style for the left side of the Rect.

read only

DOM 2 Style

4.6 or later

right

String

Returns the style for the right side of the Rect.

read only

DOM 2 Style

4.6 or later

top

String

Returns the style for the top of the Rect.

read only

DOM 2 Style

4.6 or later

Back To Top

Object: RGBColor

Availability

BlackBerry Device Software version 4.6 or later

Extends

Node

The RGBColor object represents an RGB color value.

The RGBColor object contains three properties, each of which specifies the value for a different color channel for the overall color. Valid color channel values can be either a numerical value between 0 and 255, or a percentage between 0% and 100%, although values outside of those ranges are not clipped.

Back To Top

RGBColor properties

Property name

Type

Description

Status

Support level

Availability

blue

CSSPrimitiveValue

Returns the blue value of the RGB value.

read only

DOM 2 Style

4.6 or later

green

CSSPrimitiveValue

Returns the green value of the RGB value.

read only

DOM 2 Style

4.6 or later

red

CSSPrimitiveValue

Returns the red value of the RGB value.

read only

DOM 2 Style

4.6 or later

Back To Top

Object: StyleSheet

Availability

BlackBerry Device Software version 4.6 or later

The StyleSheet object represents a single style sheet associated with a document. A StyleSheet object can represent either an external style sheet, or an inline style element.

Back To Top

StyleSheet properties

Property name

Type

Description

Status

Support level

Availability

disabled

boolean

When true, indicates that the style sheet is not applied.

Note that if the media specified in the MediaList object returned by StyleSheet.media is not supported by the BlackBerry Browser, then this property is ignored.

writable

DOM 2 Style

4.6 or later

href

DOMString

Returns the URI of an external style sheet.

read only

DOM 2 Style

4.6 or later

media

MediaList

Returns the destination media for the style information. If no media has been specified, this property returns the empty MediaList object.

The media is often specified in StyleSheet.ownerNode.

read only

DOM 2 Style

4.6 or later

ownerNode

Node

Returns the Node that associates this style sheet with the document. For HTML documents, this is typically the corresponding <link> or <style> element.

If the style sheet is the child of another style sheet, this property returns null.

read only

DOM 2 Style

4.6 or later

parentStyleSheet

StyleSheet

Returns the StyleSheet object that contains the style sheet, if one exists.

If the style sheet is not the child of another style sheet, this property returns null.

read only

DOM 2 Style

4.6 or later

title

DOMString

Returns the title of the style sheet.

The title is often specified in StyleSheet.ownerNode.

read only

DOM 2 Style

4.6 or later

type

DOMString

Returns the style sheet language used by the style sheet, specified as a content type, such as “text/css”.

The content type is often specified in StyleSheet.ownerNode.

read only

DOM 2 Style

4.6 or later

Back To Top

Object: StyleSheetList

Availability

BlackBerry Device Software version 4.6 or later

The StyleSheetList object represents an ordered collection of StyleSheet objects.

You can access an individual StyleSheet within a collection by its index position using StyleSheetList.item() or you can index the object directly. For example, if you create an instance of a StyleSheetList object called myStyleSheets, then specifying

myStyleSheets.item(2)

is equivalent to specifying

myStyleSheets[2]

Back To Top

StyleSheetList properties

Property name

Type

Description

Status

Support level

Availability

length

unsigned long

Returns the number of style sheets in the list.

read only

DOM 2 Style

4.6 or later

Back To Top

StyleSheetList methods

Method name

Description

Support level

Availability

item()

Returns the StyleSheet object at the specified index in the StyleSheetList.

DOM 2 Style

4.6 or later

Back To Top
Next topic: Events API
Previous topic: Text methods

Was this information helpful? Send us your comments.