Closed
Bug 909007
Opened 12 years ago
Closed 12 years ago
(aStyleSheet).cssRules doesn't list unknown rules
Categories
(Core :: DOM: CSS Object Model, defect)
Tracking
()
People
(Reporter: a_different_name, Unassigned)
Details
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36
Steps to reproduce:
1. Create a file containing the following:
<!DOCTYPE html>
<style> @arbitrary rule; </style>
<script>
window.addEventListener('load', function() {
if (document.implementation.hasFeature("CSS", "2.0")) {
alert(document.styleSheets[0].cssRules[0]);
}
});
</script>
2. View the file in Firefox.
Actual results:
An alert box appeared, with the message "undefined".
Expected results:
The alert box's message should read something like "[object CSSUnknownRule]".
(See http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSRule : "An implementation is expected to preserve all rules specified in a CSS style sheet, even if the rule is not recognized by the parser. Unrecognized rules are represented using the `CSSUnknownRule` interface.")
Comment 1•12 years ago
|
||
I'm sure Simon can find the spec that says we're right.
Component: Untriaged → DOM: CSS Object Model
Product: Firefox → Core
Comment 2•12 years ago
|
||
The CSSOM requirement there contradicts the parsing requirements from CSS specs, and we implement the latter.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
| Reporter | ||
Comment 3•12 years ago
|
||
Then `document.implementation.hasFeature("CSS", "2.0")` should return false. This is stated explicitly in the spec the browser claims to support; either it should be supported, or the browser should stop lying to scripts.
Comment 4•12 years ago
|
||
The current definition of hasFeature is at http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature and always returns true no matter what arguments you pass it, except for some SVG special-cases. You shouldn't use hasFeature for anything you care about.
You need to log in
before you can comment on or make changes to this bug.
Description
•