473,404 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

cssRules No Longer Works in FireFox 1.5

I have a WYSIWYG editor based on the HTMLArea project that uses the
cssRules object of a stylesheet to add/update stylesheet rules for
table cells. Ever since I upgraded to FireFox 1.5, I get the following
error message when trying to access the cssRules object:

"Access to restricted URI denied"

The code I am trying to execute looks like this:

var currStyleSheet = editor._doc.styleSheets[0];
var currRules = currStyleSheet.cssRules;
var tdIndex = currRules.length;
for(i = 0; i < currRules.length; i++) {
if(currStyleSheet.cssRules.item(i).type == 1) {
//if it is a style rule
var currRule = currRules.item(i)
if (currRule.selectorText.toLowerCase() == "td") {
tdIndex = i;
}
}

}

This code is simply looking for any rules for TD elements. I am at a
loss as to what is going on and/or what changed if FireFox to cause
this error. It worked fine in previous releases of FireFox. The
document that I am trying to access the stylesheet for is within an
IFRAME, which is what I believe is causing the problem. Thanks.

Jan 22 '06 #1
19 4408


mephraim wrote:
I have a WYSIWYG editor based on the HTMLArea project that uses the
cssRules object of a stylesheet to add/update stylesheet rules for
table cells. Ever since I upgraded to FireFox 1.5, I get the following
error message when trying to access the cssRules object:

"Access to restricted URI denied"

The code I am trying to execute looks like this:

var currStyleSheet = editor._doc.styleSheets[0];
var currRules = currStyleSheet.cssRules;


Does the error message not name the exact line number causing the error?
which line is that, the attempt to access
editor._doc
or the attempt to access
currStyleSheet.cssRules

What is the URL of the HTML document with the script, what is the URL of
the iframe? As the error message says "Access to restricted URI denied"
seeing the URIs could help.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 22 '06 #2
The error occurrs on the line with the following:

var currRules = currStyleSheet.cssRules

I am able to read the stylesheet, but it throws that error when I try
to access cssRules.

I am running this page on a development server
(http://niagara.leepfrog.com/), and the IFRAME is populated with a
series of iframe.document.write() calls, not a SRC. It works when I
try to access cssRules from the main Document sylesheet, but throws the
error when I try to access cssRules in the IFRAME from the Main
Document. Hopefully this clears thins up a little bit.

Jan 23 '06 #3


mephraim wrote:
The error occurrs on the line with the following:

var currRules = currStyleSheet.cssRules

I am able to read the stylesheet, but it throws that error when I try
to access cssRules.

I am running this page on a development server
(http://niagara.leepfrog.com/), and the IFRAME is populated with a
series of iframe.document.write() calls, not a SRC.


Do you still experience the problem? Do you have a URL with the example?
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 28 '06 #4
VK

mephraim wrote:
I have a WYSIWYG editor based on the HTMLArea project that uses the
cssRules object of a stylesheet to add/update stylesheet rules for
table cells. Ever since I upgraded to FireFox 1.5, I get the following
error message when trying to access the cssRules object:

"Access to restricted URI denied"

The code I am trying to execute looks like this:

var currStyleSheet = editor._doc.styleSheets[0];
var currRules = currStyleSheet.cssRules;
var tdIndex = currRules.length;
for(i = 0; i < currRules.length; i++) {
if(currStyleSheet.cssRules.item(i).type == 1) {
//if it is a style rule
var currRule = currRules.item(i)
if (currRule.selectorText.toLowerCase() == "td") {
tdIndex = i;
}
}

}


Uhmm... and who told you that ever worked for Firefox at all? Did you
get yours from mozilla.org ?

Presuming that your style sheet has an ID (the only way to work
reliably with Firefox) and this ID is say "myCSS" then:

document.getElementById('myCSS').sheet.cssRules[0].style.backgroundColor;
and so on...

Works just fine since 1.0.4

Jan 28 '06 #5
VK wrote:
mephraim wrote:
I have a WYSIWYG editor based on the HTMLArea project that uses the
cssRules object of a stylesheet to add/update stylesheet rules for
table cells. Ever since I upgraded to FireFox 1.5, I get the
following error message when trying to access the cssRules object:

"Access to restricted URI denied"

The code I am trying to execute looks like this:

var currStyleSheet = editor._doc.styleSheets[0];
var currRules = currStyleSheet.cssRules;
var tdIndex = currRules.length;
for(i = 0; i < currRules.length; i++) {
if(currStyleSheet.cssRules.item(i).type == 1) {
//if it is a style rule
var currRule = currRules.item(i)
if (currRule.selectorText.toLowerCase() == "td") {
tdIndex = i;
}
}

}
Uhmm... and who told you that ever worked for Firefox at all?


It is specified so.
Did you get yours from mozilla.org ?
Obviously you did not.
Presuming that your style sheet has an ID (the only way to work
reliably with Firefox)
Nonsense, Firefox (i.e. the Gecko DOM) provides the document.styleSheets
collection (a reference to a StyleSheetList object) accessed here as
specified in W3C DOM Level 2 Style.
and this ID is say "myCSS" then:

document.getElementById('myCSS').sheet.cssRules[0].style.backgroundColor;
and so on...
Nonsense:
Works just fine since 1.0.4


Of course it does not. A CSSStyleSheet object referred to by the return
value of document.getElementById() here does not have a 'sheet' property
at all. What would also work instead is

document.getElementById('myCSS').cssRules[0].style.backgroundColor;

However this required an ID while the document.styleSheets collection did
not. Unfortunately as usual, the information you provided is factually
flawed and therefore potentially harmful to others.
PointedEars
Jan 28 '06 #6
VK

Thomas 'PointedEars' Lahn wrote:
However this required an ID while the document.styleSheets collection did
not. Unfortunately as usual, the information you provided is factually
flawed and therefore potentially harmful to others.


as usual 2 months of experiments are defited by one specs reading...

Jan 28 '06 #7
VK wrote:
Thomas 'PointedEars' Lahn wrote:
However this required an ID while the document.styleSheets collection did
not. Unfortunately as usual, the information you provided is factually
flawed and therefore potentially harmful to others.


as usual 2 months of experiments are defited by one specs reading...


What are you babbling about? The Gecko DOM does _not_ specify nor
_implement_ a `sheet' property for CSSStyleSheet objects. However, it has
specified _and_ has _implemented_ the document.styleSheets collection ever
since.

<URL:http://developer.mozilla.org/en/docs/DOM:style>

If your tests showed the opposite, then your tests are flawed. Which would
not be surprising, though.
PointedEars
Jan 28 '06 #8
On 28/01/2006 17:36, Thomas 'PointedEars' Lahn wrote:
VK wrote:
[snip]
Uhmm... and who told you that [styleSheets and cssRules
collections] ever worked for Firefox at all?


It is specified so.


Quite right, though more importantly, it is implemented as such (since
at least Moz 1.3 - the earliest Gecko browser I have available at the
moment).

[snip]
Nonsense, Firefox (i.e. the Gecko DOM) provides the
document.styleSheets collection (a reference to a StyleSheetList
object) accessed here as specified in W3C DOM Level 2 Style.
Again, very true.

[snip]
A CSSStyleSheet object referred to by the return value of
document.getElementById() here does not have a 'sheet' property at
all.
An object implementing the CSSStyleSheet interface does not have a sheet
property, as you say, but a LINK or STYLE element that references a
cascading style sheet doesn't implement the CSSStyleSheet interface
directly. Instead, they both implement the LinkStyle interface, which
only has one property, sheet (and that does implement the StyleSheet
interface).
What would also work instead is

document.getElementById('myCSS').cssRules[0].style.backgroundColor;


You should have tested that; it doesn't (though I'm guilty of the same
charge on occasions when I'm feeling lazy :-/).

[snip]

It seems to me that this should be a security issue: the OP is trying to
access style sheet rules from an IFRAME element that isn't part of the
same domain (from the description, there's no URL). That said, I thought
security issues started when trying to access the document object[1].

Mike
[1] I don't 'do' frames, so I'll plead ignorance, here. It's a
potential starting point, though.

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
Jan 28 '06 #9
On 28/01/2006 20:30, VK wrote:

[snip]
as usual 2 months of experiments are defited by one specs reading...


It took you two months to conclude that the Gecko DOM doesn't support
the styleSheets collection, when in fact it does?

Mike

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
Jan 28 '06 #10
Michael Winter wrote:
On 28/01/2006 17:36, Thomas 'PointedEars' Lahn wrote:
VK wrote:
Uhmm... and who told you that [styleSheets and cssRules
collections] ever worked for Firefox at all?
It is specified so.


Quite right, though more importantly, it is implemented as such (since
at least Moz 1.3 - the earliest Gecko browser I have available at the
moment).


I think it has been a Gecko DOM feature ever since. However, it is good
that you mention in works in release version 1.3, too, because the Cross
Reference at MDC says it worked since 1.4:

<URL:http://developer.mozilla.org/en/docs/DOM_Client_Object_Cross-Reference:document>

I guess I should correct this. Could you please post the original
User-Agent header or navigator.userAgent property value of the Mozilla/5.0
UA you have tested with?
A CSSStyleSheet object referred to by the return value of
document.getElementById() here does not have a 'sheet' property at
all.


An object implementing the CSSStyleSheet interface does not have a sheet
property, as you say, but a LINK or STYLE element that references a
cascading style sheet doesn't implement the CSSStyleSheet interface
directly. Instead, they both implement the LinkStyle interface, which
only has one property, sheet (and that does implement the StyleSheet
interface).


Correct.
What would also work instead is

document.getElementById('myCSS').cssRules[0].style.backgroundColor;


You should have tested that;


I have now and was quite surprised that there is a difference indeed.
it doesn't [...]
You are right. I consider this another reason why one should use
document.styleSheets instead, if possible.
It seems to me that this should be a security issue: the OP is trying to
access style sheet rules from an IFRAME element that isn't part of the
same domain
The same _second-level_ domain, to be exact. You can "cheat" the SOP by
assigning a value to `document.domain'.
(from the description, there's no URL).
Yeah, maybe it is a resource accessed with a http:// URI/URL trying to
access a resource with a file:// URI.
That said, I thought security issues started when trying to access the
document object[1].


That was my assumption as well and as Martin already asked the OP about
this, I found it unnecessary to ask again. However, since the OP did not
to post the relevant URIs to date it only stays an educated guess :-/
Regards,
PointedEars
Jan 29 '06 #11
Thomas 'PointedEars' Lahn wrote:
Michael Winter wrote:
Thomas 'PointedEars' Lahn wrote:
VK wrote:
Uhmm... and who told you that [styleSheets and cssRules
collections] ever worked for Firefox at all?

It is specified so.
Quite right, though more importantly, it is implemented
as such (since at least Moz 1.3 - the earliest Gecko
browser I have available at the moment).


I think it has been a Gecko DOM feature ever since.


The oldest Gecko browser I have that implements document.styleSheets
(with cssRules) is 0.9.3, which is as close to being 'ever since' as you
would want.

<snip> I guess I should correct this. Could you please post the
original User-Agent header or navigator.userAgent property
value of the Mozilla/5.0 UA you have tested with?

<snip>

Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.3) Gecko/20010801

Richard.
Jan 29 '06 #12
Richard Cornford wrote:
Thomas 'PointedEars' Lahn wrote:
Michael Winter wrote:
Thomas 'PointedEars' Lahn wrote:
VK wrote:
> Uhmm... and who told you that [styleSheets and cssRules
> collections] ever worked for Firefox at all? [...]

I think it has been a Gecko DOM feature ever since.


The oldest Gecko browser I have that implements document.styleSheets
(with cssRules) is 0.9.3, which is as close to being 'ever since' as you
would want.


Thanks.
<snip>
I guess I should correct this. Could you please post the
original User-Agent header or navigator.userAgent property
value of the Mozilla/5.0 UA you have tested with?

<snip>

Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.3) Gecko/20010801


[x] done:
<URL:http://developer.mozilla.org/en/docs/Talk:DOM_Client_Object_Cross-Reference:document>
PointedEars
Jan 29 '06 #13
Richard Cornford wrote:
Thomas 'PointedEars' Lahn wrote:
Michael Winter wrote:
Thomas 'PointedEars' Lahn wrote:
VK wrote:
> Uhmm... and who told you that [styleSheets and cssRules
> collections] ever worked for Firefox at all? [...]

I think it has been a Gecko DOM feature ever since.


The oldest Gecko browser I have that implements document.styleSheets
(with cssRules) is 0.9.3, which is as close to being 'ever since' as you
would want.


Thanks.
<snip>
I guess I should correct this. Could you please post the
original User-Agent header or navigator.userAgent property
value of the Mozilla/5.0 UA you have tested with?

<snip>

Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.3) Gecko/20010801


[x] done:
<URL:http://developer.mozilla.org/en/docs/DOM_Client_Object_Cross-Reference:document>
PointedEars
Jan 29 '06 #14
VK

VK wrote:
as usual 2 months of experiments are defited by one specs reading...


"The Sleep of Reason Produces Monsters"
Francisco de Goya y Lucientes

document.styleSheets *is* supported by FF 1.5

Jan 30 '06 #15
VK wrote:
VK wrote:
as usual 2 months of experiments are defited by one specs reading...
"The Sleep of Reason Produces Monsters"
Francisco de Goya y Lucientes


You should not quote wisdom that you are incapable to understand.
document.styleSheets *is* supported by FF 1.5


_You_ stated that it is not:

,-[news:11**********************@g14g2000cwa.googlegr oups.com]
|
| > var currStyleSheet = editor._doc.styleSheets[0];
|
| [...] and who told you that ever worked for Firefox at all?
|
| Presuming that your style sheet has an ID (the only way to work
| reliably with Firefox) [...]

And you have been disproven by me:

,-[news:26****************@PointedEars.de]
|
| > Presuming that your style sheet has an ID (the only way to work
| > reliably with Firefox)
|
| Nonsense, Firefox (i.e. the Gecko DOM) provides the document.styleSheets
| collection (a reference to a StyleSheetList object) accessed here as
| specified in W3C DOM Level 2 Style.

How more stupid can you possibly act?
PointedEars
Jan 30 '06 #16
VK

Thomas 'PointedEars' Lahn wrote:
You should not quote wisdom that you are incapable to understand.
How more stupid can you possibly act?


OK, document.styleSheets doesn't act as *I* would like it to act to,
but it does act somehow which is OK by me really.
Over the last 3 months JSONet project had been banned out of all public
incubators (like http://sourceforge.net/) as soon as I mentioned "Ajax
free solution". In case of any real or (my troubled mind produced)
imaginary troubles:

1) It is possible to transmit any proprietary data over the current CSS
standards.

2) Any transmission of such data over the current CSS rules is a public
domain free GNU-licensed exploit of currently existing public formats.

3) Anyone willing to copyright this GNU-announced format has to proove
that his/her idea of data trasmission over CSS took place time before
this announcement.

Jan 30 '06 #17
"VK" <sc**********@yahoo.com> writes:
2) Any transmission of such data over the current CSS rules is a public
domain free GNU-licensed exploit of currently existing public formats.
That makes no sense, whatsoever.
The GNU license covers software covered by copyright.
The method of transmission is an idea, which can not be copyrighted.
It might be patentable, although I hope not.
3) Anyone willing to copyright this GNU-announced format has to proove
that his/her idea of data trasmission over CSS took place time before
this announcement.


As you say: "idea". Ideas are not copyrighted, they are patented.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jan 30 '06 #18
VK

Lasse Reichstein Nielsen wrote:
"VK" <sc**********@yahoo.com> writes:
2) Any transmission of such data over the current CSS rules is a public
domain free GNU-licensed exploit of currently existing public formats.
That makes no sense, whatsoever.
The GNU license covers software covered by copyright.
The method of transmission is an idea, which can not be copyrighted.
It might be patentable, although I hope not.


It is software, not hardware domain, where you need to make something
blinking and working for (c). In software an idea is often == solution.
And to destinguish between a bright (or not too much) idea and a
patentable algorythm is a real puzzle.

<http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&p=1&u=/netahtml/search-bool.html&r=2&f=G&l=50&co1=AND&d=pall&s1=javascrip t.TTL.&OS=TTL/javascript&RS=TTL/javascript>

Would you believe it? I wouldn't - and I still don't believe that the
above is practically applicable. But I don't want to repeat the story
in any shell perform form. It is not about personal benefits or glory -
the practical usability of what I am doing is a big question. But in
case if it is usable, I want to prevent any "smart people" like that
Honkong team from any attempt to take it out of public free domain.

1) Dynamic CSS file implant (using <LINK>)
2) CSS file like:
..data {
font-face: fantasy, "JSON%20URLEncoded%20data"
}
(there are 7 more style rules which can be used)

The rest are technical issues of threading and onload monitoring I'm
working on.

Cross-domain free.
Secure - data delivered and parsed as text, you have to explicetly
convert it into JavaScript
Support by any browser with full or partial CSS2 support (currently for
sure FF 1.x, IE 5.5, Camino 1.x)
As you say: "idea". Ideas are not copyrighted, they are patented.


Right, thank you. I have to intention to do neither of both, but terms
are important.

Feb 1 '06 #19
VK wrote:
Lasse Reichstein Nielsen wrote:
"VK" <sc**********@yahoo.com> writes:
> 2) Any transmission of such data over the current CSS rules is a public
> domain free GNU-licensed exploit of currently existing public formats.


That makes no sense, whatsoever.
The GNU license covers software covered by copyright.
The method of transmission is an idea, which can not be copyrighted.
It might be patentable, although I hope not.


It is software, not hardware domain, where you need to make something
blinking and working for (c). In software an idea is often == solution.


Oh please read the GNU GPL and shut up. We (and I am sure I am not the
only one) had enough of your nonsense now.
PointedEars
Feb 1 '06 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Christopher Benson-Manica | last post by:
Supposedly IE implements the cssRules property for a stylesheet. So why is the word 'foo' in the below page red and not blue? <html> <head> <style> .foo { color: #ff0000; } </style> </head>...
5
by: Derek Erb | last post by:
I am banging my head against the wall with this one. The following code snippets work perfectly fine in MSIE6. But produce an error in Firefox and do not work at all. BROWSER.HTM <HTML> .......
11
by: lkrubner | last post by:
We are working on a website that is here: http://www.lauradenyes.com/ The site was working till I put up an .htaccess file that was suppose to redirect all html files to the PHP parser. The...
14
by: David Blickstein | last post by:
I have some XML documents that I want to open in a web browser and be automatically translated to HTML via XSLT. I'm using an xml-stylesheet processing command in a file called "girml.xml". ...
21
by: PlainDave | last post by:
Hi, Is there a way to make windows tooltips stay up longer than the default 5 seconds using CSS in a web page? I'd prefer to have it stay visible as long as the mouse is over the "whatever." The...
4
by: puja | last post by:
hi all, I have an asp.net website where am including .css file dynamically on page load event. For diff users, there is diff CSS file. So after user logs in, I am setting CSS href on page load....
28
by: entfred | last post by:
I have the following line of html: &nbsp;&nbsp1234&nbsp;&nbsp;&nbsp;&nbsp;&nbspabc&nbsp;&nbsp;&nbspyow In Internet Explorer 6.0, the columns look ok using the above html: 1234 abcd ...
13
by: Stever1975 | last post by:
I'm working on something similiar to a shopping cart item page. There is a table of items. Each item has an image, a textbox for the qty and an image for the add button. When the add image is...
5
by: lorlarz | last post by:
Sparkline Graphs no longer work in Firefox. I am pissed. Does anyone care? Here is what used to run in FireFox 1.5 and 2, but no longer works in Firefox 3 (not on PC or Linux anyway). Anyone...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.