Closed
Bug 285478
Opened 20 years ago
Closed 20 years ago
Cannot access document.styleSheets[0].cssRules in XHTML
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: aaronlev, Unassigned)
Details
(Whiteboard: dhtml-access)
Attachments
(2 files)
NS_DOM_ERROR_BAD_URI exception for javascript:alert(document.styleSheets[0].cssRules); Steps: 1. Load HTML document, execute javascript:alert(document.styleSheets[0].cssRules); The alert should say [object CSSRuleList] 2. Load XHTML document, execute same JS rule No alert will show up. The JavaScript console reports NS_ERROR_DOM_BAD_URI
| Reporter | ||
Comment 1•20 years ago
|
||
| Reporter | ||
Comment 2•20 years ago
|
||
| Reporter | ||
Updated•20 years ago
|
Whiteboard: dhtml-access
Comment 3•20 years ago
|
||
This fails because in the XHTML document document.styleSheets[0] seems to be coming from "http://www.w3.org/StyleSheets/TR/base", so our security checks block access (from bugzilla).
Comment 4•20 years ago
|
||
The source has: <?xml-stylesheet type="text/css" href="http://www.w3.org/StyleSheets/TR/base"?> In XHTML that means a stylesheet to be loaded, and we can't allow access to that sheet for security reasons, as you pointed out. In HTML it means absolutely nothing (and isn't even included in the testcase), so the [0] element of styleSheets comes from the <style>. Accessing that is fine. Sounds like everything is working correctly.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•