Open Bug 478807 Opened 15 years ago Updated 2 years ago

Access stylesheet in stylesheet collection by id

Categories

(Firefox :: General, enhancement)

x86
Windows XP
enhancement

Tracking

()

UNCONFIRMED

People

(Reporter: gregory.houston, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6

Working with multiple stylesheets in the DOM is unneccessarily difficult since the stylesheets cannot be accesed by name or id, but merely by position in an array.

Where, "myStyle" is the id of my stylesheet, in Internet Explorer you can access a stylesheet in the stylesheet collection by id as follows:

alert(document.styleSheets.myStyle.rules.length);

I would like to see the same functionality available in Firefox, though of course the example above would be the following for Firefox:

alert(document.styleSheets.myStyle.cssRules.length);





Reproducible: Always

Steps to Reproduce:
1. Add a stylesheet with id="myStyle" to the document.
2. Run: alert(document.styleSheets.myStyle.cssRules.length);
Actual Results:  
Error: document.styleSheets.myStyle is undefined

Expected Results:  
Return the number of rules in document.styleSheets.myStyle
This is a mass search for bugs which are in the Firefox General component, are
UNCO, have not been changed for 500 days and have an unspecified version. 

Reporter, can you please update to Firefox 3.6.10 or later, create a fresh profile, http://support.mozilla.com/en-US/kb/managing+profiles, and test again. If you still see the issue, please update this bug. If the issue is gone, please set the status to RESOLVED > WORKSFORME.
Whiteboard: [CLOSEME 2010-11-01]
Whiteboard: [CLOSEME 2010-11-01]
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.