WD-DOM-Level-2-19990304


3. Document Object Model StyleSheets

Editors
Vidur Apparao, Netscape Communications Corp.
Chris Wilson, Microsoft

Table of contents


3.1. Introduction

The DOM Level 2 Style Sheet interfaces are base interfaces used to represent any type of style sheet. The expectation is that DOM modules that represent a specific style sheet language may contain interfaces that derive from these interfaces.

3.2. Style Sheet Interfaces

This set of interfaces represents the generic notion of style sheets.

Interface StyleSheet

The StyleSheet interface is the abstract base interface for any type of style sheet. It represents a single style sheet associated with a structured document. In HTML, the StyleSheet interface represents either an external style sheet, included via the HTML LINK element, or an inline STYLE element. In XML, this interface represents an external style sheet, included via a style sheet processing instruction .

IDL Definition
interface StyleSheet {
  readonly attribute  DOMString            type;
           attribute  boolean              disabled;
  readonly attribute  Node                 owningNode;
  readonly attribute  StyleSheet           parentStyleSheet;
  readonly attribute  DOMString            href;
  readonly attribute  DOMString            title;
  readonly attribute  DOMString            media;
};

Attributes
type
This specifies the style sheet language for this style sheet. The style sheet language is specified as a content type (e.g. "text/css"). The content type is often specified in the owningNode. A list of registered content types can be found at ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/ . Also see the type attribute definition for the LINK element in HTML 4.0, and the type pseudo-attribute for the XML style sheet processing instruction .
disabled
false if the style sheet is applied to the document. true if it is not.
owningNode
The node that associates this style sheet with the document. For HTML, this may be the corresponding LINK or STYLE element. For XML, it may be the linking processing instruction. For included style sheets, this attribute has a value of null.
parentStyleSheet
For style sheet languages that support the concept of style sheet inclusion, this attribute represents the including style sheet, if one exists. If the style sheet is a top-level style sheet, or the style sheet language does not support inclusion, the value of the attribute is null.
href
If the style sheet is a linked style sheet, the value of its attribute is its location. For inline style sheets, the value of this attribute is null. See the href attribute definition for the LINK element in HTML 4.0, and the href pseudo-attribute for the XML style sheet processing instruction .
title
The advisory title. The title is often specified in the owningNode. See the title attribute definition for the LINK element in HTML 4.0, and the title pseudo-attribute for the XML style sheet processing instruction .
media
The intended destination medium for style information. It may be a single media descriptor or a comma-separated list. The media is often specified in the owningNode. See the media attribute definition for the LINK element in HTML 4.0, and the media pseudo-attribute for the XML style sheet processing instruction .
Interface StyleSheetCollection

The StyleSheetCollection interface provides the abstraction of an ordered collection of style sheets.

IDL Definition
interface StyleSheetCollection {
  readonly attribute  unsigned long        length;
  StyleSheet                item(in unsigned long index);
};

Attributes
length
The length or the size of the list.
Methods
item
Used to retrieve a style sheet by ordinal index.
Parameters
index

Index into the collection

Return Value
The style sheet at the index position in the StyleSheetCollection, or null if that is not a valid index.

This method raises no exceptions.