Closed Bug 745941 Opened 12 years ago Closed 12 years ago

CSS media query (orientation) evaluates true

Categories

(Core :: CSS Parsing and Computation, defect)

11 Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: eric, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:11.0) Gecko/20100101 Firefox/11.0 Build ID: 20120312181643 Steps to reproduce: Created a CSS rule like so: @media (orientation) { body {background: green;} } Actual results: The body background was green. Expected results: The rule should have been ignored. Per http://www.w3.org/TR/css3-mediaqueries/#media1: “For a media feature feature, (feature) will evaluate to true if (feature:x) will evaluate to true for a value x other than zero or zero followed by a unit identifier (i.e., other than 0, 0px, 0em, etc.).” Per http://www.w3.org/TR/css3-mediaqueries/#orientation, the only valid values for 'orientation' are 'portrait' and 'landscape'. Can it evaluate to true under the defined constraints? (For comparison, WebKit evaluates to false; Opera to true. Was not able to test in Explorer.)
Component: Untriaged → Style System (CSS)
Product: Firefox → Core
QA Contact: untriaged → style-system
> Can it evaluate to true under the defined constraints? Seems like the spec is pretty clear. If there is any value x other than 0 or a zero length that makes (orientation: x) evaluate to true, then (orientation) evaluates to true. There is certainly such a value at all times: either x == landscape or x == portrait. I'm not sure what part of the spec made you think anything here should be ignored. Nothing in the spec says to ignore this query, as far as I can see. Please do file a bug on WebKit for their buggy implementation. Or let me know and I'll do it; either way.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
Ah, I see. The wording there is (to me, and probably most non-CS veterans) very misleading. What it strongly implies (again, to me) is that it only applies when values are or can be numeric with or without a unit, which would preclude keyword-based values from ever matching. I believe I now grasp the intended logic. Apologies!
Oh, and I’ll go see about filing a WebKit bug. I think I might have a login over there…
No need to apologize. It might be worth raising a spec issue here too; I agree the spec could be clearer here.
You need to log in before you can comment on or make changes to this bug.