Last Comment Bug 63850 - document.implementation.createCSSStyleSheet() Not Implemented
: document.implementation.createCSSStyleSheet() Not Implemented
Status: RESOLVED INVALID
: dom2
Product: Core
Classification: Components
Component: DOM: CSS Object Model (show other bugs)
: Trunk
: All All
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2000-12-27 22:21 PST by DOM Question
Modified: 2010-11-13 07:45 PST (History)
13 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description DOM Question 2000-12-27 22:21:52 PST
From:  Johnny Stenback <jst@netscape.com>
To:  DOM Question <domquestion@hotmail.com>
Subject:  Re: How to create stylesheet in DOM? 
Date:  Wed, 27 Dec 2000 18:47:56 -0800 
DOM Question wrote: 

Is there an equivalent to the following IE Javascript code? 

newStyleSheet=document.createStyleSheet(); 
newStyleSheet.addRule(a,b); 

In other words, how can I create a dynamic stylesheet that can be 
accessed something like: 

document.stylesheet[0].rule[0] 
or 
document.stylesheet[0].cssrule[0] 
or 
whatever? 

-----
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! 

Regards,
domquestion@hotmail.com
Pun Intended LOL :)
Comment 1 Johnny Stenback (:jst, jst@mozilla.com) 2000-12-28 02:59:35 PST
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! :-)
Comment 2 Hixie (not reading bugmail) 2001-02-22 22:54:52 PST
Taking QA Contact on all open or unverified DOM Style bugs...
Comment 3 Hixie (not reading bugmail) 2001-04-26 17:08:24 PDT
Nominating this bug for nsbeta1 on behalf of gerardok@netscape.com.
Comment 4 Hixie (not reading bugmail) 2001-05-03 18:44:41 PDT
Removing nsbeta1 nomination -- there was a misunderstanding and some "approved
out features" were nominated by mistake! Sorry!
Comment 5 Boris Zbarsky [:bz] (Out June 25-July 6) 2002-06-11 18:30:56 PDT
I'm a glutton for punishment....
Comment 6 Boris Zbarsky [:bz] (Out June 25-July 6) 2002-06-12 14:33:33 PDT
OK. So document.implementation.createCSSStyleSheet() is completely useless. 
From
http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.html#CSS-DOMImplementationCSS:

    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.
Comment 7 Boris Zbarsky [:bz] (Out June 25-July 6) 2004-01-06 16:23:50 PST
No plans to work on this any time in the foreseeable future, so to default owner.
Comment 8 Benjamin Kalytta 2007-12-19 02:25:42 PST
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?
Comment 9 :Ms2ger 2010-11-13 07:45:30 PST
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.

Note You need to log in before you can comment on or make changes to this bug.