W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2000

Re: style sheets

From: Philippe Le Hegaret <plh@w3.org>
Date: Fri, 24 Mar 2000 21:37:18 +0000
Message-ID: <38DBE00E.F21A11CC@w3.org>
To: Dieter Köhler <dieter.koehler@ppp.uni-bamberg.de>
CC: "www-dom@w3.org" <www-dom@w3.org>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:47 GMT