From: Johnny Stenback <email@example.com>
To: DOM Question <firstname.lastname@example.org>
Subject: Re: How to create stylesheet in DOM?
Date: Wed, 27 Dec 2000 18:47:56 -0800
DOM Question wrote:
In other words, how can I create a dynamic stylesheet that can be
accessed something like:
This is unfortunately impossible in mozilla, the standard way of
creating stylesheets would be:
var newStyleSheet = document.implementation.createCSSStyleSheet("a
title", "a media");
but that's unfortunately not implemented in mozilla either, and even if
this would work there's no standard way to associate a new stylesheet
with a document. Feel free to file bugs on these missing features (DOM
Level 2) in http://bugzilla.mozilla.org.
Thanks in advance!
Pun Intended LOL :)
This is something we'd wanto implement in mozilla as we have time to but
currently there are more important things to fix so I'll haveto mark this as
Future for now, thanks for filing this tho! :-)
Taking QA Contact on all open or unverified DOM Style bugs...
Nominating this bug for nsbeta1 on behalf of email@example.com.
Removing nsbeta1 nomination -- there was a misunderstanding and some "approved
out features" were nominated by mistake! Sorry!
I'm a glutton for punishment....
OK. So document.implementation.createCSSStyleSheet() is completely useless.
This interface allows the DOM user to create a CSSStyleSheet outside the
context of a document. There is no way to associate the new CSSStyleSheet with
a document in DOM Level 2.
In other words, there is nothing useful you can do with the stylesheet it gives
you. Daniel, this seems like something that the CSS WG should take a look
at.... Either remove this or make it useful. ;)
Creating a <style> element and appending it into the DOM will create a useful
(attached to document) stylesheet in the meantime.
Futuring, but please let me know if I'm missing something that makes this worth
implementing in the near term.
No plans to work on this any time in the foreseeable future, so to default owner.
This would be indeed a usefull feature.
Why does following assignment don't work?
var styleSheet = document.implementation.createCSSStyleSheet("Test", "all");
document.styleSheets[document.styleSheets.length - 1] = styleSheet;
Theoretically this should work or not?
No longer present in the specification: <http://dev.w3.org/csswg/cssom/>
(In reply to comment #8)
> This would be indeed a usefull feature.
> Why does following assignment don't work?
> var styleSheet = document.implementation.createCSSStyleSheet("Test", "all");
> document.styleSheets[document.styleSheets.length - 1] = styleSheet;
> Theoretically this should work or not?
No, document.styleSheets[document.styleSheets.length - 1] can't be set.