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.
This set of interfaces represents the generic notion of style sheets.
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 .
interface StyleSheet { readonly attribute DOMString type; attribute boolean disabled; readonly attribute Node ownerNode; readonly attribute StyleSheet parentStyleSheet; readonly attribute DOMString href; readonly attribute DOMString title; readonly attribute MediaList media; };
type
ownerNode
.
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. Modifying this attribute may cause
a reresolution of style for the document.
ownerNode
LINK
or STYLE
element. For XML, it may be the linking processing instruction. For
style sheets that are included by other style sheets, this attribute
has a value of null.
parentStyleSheet
href
LINK
element in HTML
4.0, and the href pseudo-attribute for the XML style sheet processing
instruction .
title
ownerNode
. 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
ownerNode
.
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 .
The StyleSheetList
interface provides the
abstraction of an ordered collection of style sheets.
interface StyleSheetList { readonly attribute unsigned long length; StyleSheet item(in unsigned long index); };
length
StyleSheet
in the list. The range of valid
child stylesheet indices is 0
to length-1
inclusive.
item
index |
Index into the collection |
index
position in the
StyleSheetList
, or null
if
that is not a valid index.
The MediaList
interface provides the abstraction of an
ordered collection of media, without defining or constraining how this
collection is implemented. All media are lowercase strings.
interface MediaList { attribute DOMString cssText; // raises(DOMException) on setting readonly attribute unsigned long length; DOMString item(in unsigned long index); void delete(in DOMString oldMedium) raises(DOMException); void append(in DOMString newMedium) raises(DOMException); };
cssText
DOMException
SYNTAX_ERR: Raised if the specified CSS string value has a syntax error and is unparsable.
NO_MODIFICATION_ALLOWED_ERR: Raised if this media list is readonly.
length
0
to length-1
inclusive.
item
index
th in the list. If index
is
greater than or equal to the number of media in the list, this returns
null
.
index |
Index into the collection. |
index
th position in the
MediaList
, or null
if that is not a
valid index.
delete
oldMedium
from the list.
oldMedium |
The medium to delete in the media list. |
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised if this list is readonly.
NOT_FOUND_ERR: Raised if oldMedium
is not in the list.
append
newMedium
to the end of the list. It the
newMedium
is already used, it is first removed.
newMedium |
The new medium to add. |
DOMException
NO_MODIFICATION_ALLOWED_ERR: Raised if this list is readonly.
The DocumentStyle
interface provides a mechanism by
which the style sheets embedded a document can be
retrieved. The expectation is that an instance of the
DocumentStyle
interface can be obtained by using
binding-specific casting methods on an instance of the Level 1
Document interface.
interface DocumentStyle { readonly attribute StyleSheetList styleSheets; };
styleSheets