Help Center

Local Navigation

Object: CSSStyleSheet

Availability

BlackBerry® Device Software version 4.6 or later

Extends

StyleSheet

The CSSStyleSheet object represents a CSS style sheet.

CSSStyleSheet properties

Property name

Type

Description

Status

Availability

CSSRules

CSSRuleList

Returns an array of the CSSRule objects in the style sheet.

read only

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

4.6 or later

CSSStyleSheet methods

Method name

Description

Availability

deleteRule()

Deletes a CSS Rule at the given position in the CSS style sheet.

4.6 or later

insertRule()

Adds a CSS Rule at the given position in the CSS style sheet.

4.6 or later

Method: CSSStyleSheet.deleteRule()

Availability

BlackBerry® Device Software version 4.6 or later

The deleteRule() method deletes a CSS Rule at the given position in the CSS style sheet.

Syntax

CSSStyleSheet.deleteRule( index )

Parameters

Parameter

Type

Description

index

int

An integer that represents the CSS rules’s position in the style sheet’s collection of rules.

Return values

None.

Exceptions

Exception

Description

NO_MODIFICATION_ALLOWED_ERR

This error is thrown if the style sheet is read only.

INDEX_SIZE_ERR

This error is thrown if index does not correspond to any rule in the style sheet’s collection of rules.

Method: CSSStyleSheet.insertRule()

Availability

BlackBerry® Device Software version 4.6 or later

The insertRule() method adds a CSS Rule at the given position in the CSS style sheet.

Syntax

CSSStyleSheet.insertRule( rule, index )

Parameters

Parameter

Type

Description

rule

String

The parsable text for the CSS Rule to add.

  • For rule sets, rule includes both the selector and the style declaration.

  • For @-rules, rule includes both the @-identifier and the rule content.

index

int

An integer that represents the position in the style sheet’s collection of rules at which the new rule is inserted. If index is equal to CSSRuleList.length, the rule is added to the end of the list of rules.

Return values

Returns the position of the newly added style sheet in the style sheet’s collection of rules.

Exceptions

Exception

Description

NO_MODIFICATION_ALLOWED_ERR

This error is thrown if the style sheet is read only.

INDEX_SIZE_ERR

This error is thrown if index does not correspond to any rule in the style sheet’s collection of rules.

Previous topic: CSSStyleRule properties

Was this information helpful? Send us your comments.