Re: style sheets

Dieter Köhler wrote:
> 
> In trying to implement the DOM style sheet feature I come across the
> problem where to locate the factory methods for styleSheet,
> styleSheetList, LinkStyle, and DocumentStyle.
> DOM2, p.133 reads: "The DocumentStyle interface provides a mechanism
> by which the style sheets embedded in 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 Document interface."  That treats a styleSheet as related to a
> Document node and suggests implementing the factory methods at the
> Document interface.

There is a relation from the style sheet to the document through the
StyleSheet.ownerNode attribute. We don't have a factory method to
create a style sheet associated with a document. See also
http://www.w3.org/TR/2000/CR-DOM-Level-2-20000307/stylesheets.html#StyleSheets-Association

> But there are two problems:
> 
> 1. PIs related to style sheets can occur outside the root element. (As
> I was told before, PIs outside the root element would be addressed in
> DOM3.  I just want to warn that the binding of the DocumentStyle
> interface to the Document interface might be a hidden preliminary
> decision of this issue.)

PIs outside the root element are addressed in DOM2. They are childs
of the Document.

> 2. Since a style sheet might be attached to different documents, it
> would be naturally to implement the factory method for the styleSheet
> on the DOMImplementation interface and likely to have a DocumentStyle
> method on the DOMImplementation as well. Instead of the disabled
> attribute of the StyleSheet we would need a list of all documents
> which apply the style sheet.

Actually, there is a method to create a stylesheet from
a DOMImplementation, see 
http://www.w3.org/TR/2000/CR-DOM-Level-2-20000307/css.html#CSS-DOMImplementationCSS
But, since there is no way to associate the style sheet to a document,
this method is useful only for the CSS editors.
A style sheet can be associated to only one ownerNode, so it can be
attached to more than one document.

Regards,
Philippe.

Received on Friday, 24 March 2000 16:37:22 UTC