Closed Bug 63850 Opened 24 years ago Closed 14 years ago

document.implementation.createCSSStyleSheet() Not Implemented

Categories

(Core :: DOM: CSS Object Model, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: DOMQuestion, Unassigned)

Details

(Keywords: dom2)

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 :)
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! :-)
Severity: blocker → normal
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Priority: -- → P3
Target Milestone: --- → Future
Keywords: dom2
Component: DOM Level 2 → DOM Style
Taking QA Contact on all open or unverified DOM Style bugs...
QA Contact: vidur → ian
Nominating this bug for nsbeta1 on behalf of gerardok@netscape.com.
Keywords: nsbeta1
Removing nsbeta1 nomination -- there was a misunderstanding and some "approved
out features" were nominated by mistake! Sorry!
Keywords: nsbeta1
I'm a glutton for punishment....
Assignee: jst → bzbarsky
Status: ASSIGNED → NEW
Target Milestone: Future → mozilla1.2alpha
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.
Priority: P3 → P5
Target Milestone: mozilla1.2alpha → Future
No plans to work on this any time in the foreseeable future, so to default owner.
Assignee: bz-vacation → general
Priority: P5 → --
Target Milestone: Future → ---
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?
Assignee: general → nobody
QA Contact: ian → general
QA Contact: general → style-system
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.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.