Closed
Bug 757554
Opened 13 years ago
Closed 11 years ago
media query parsing should reject all uses of "not", "only", "and", and "or" as media_type
Categories
(Core :: CSS Parsing and Computation, defect)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla24
People
(Reporter: kennyluck, Assigned: dbaron)
References
()
Details
(Keywords: dev-doc-complete, Whiteboard: [DocArea=CSS])
Attachments
(4 files)
1.11 KB,
text/html
|
Details | |
1.02 KB,
patch
|
dbaron
:
review-
|
Details | Diff | Splinter Review |
3.36 KB,
patch
|
Details | Diff | Splinter Review | |
5.72 KB,
patch
|
heycam
:
review+
|
Details | Diff | Splinter Review |
The rule-based syntax in the spec # media_query # : [ONLY | NOT]? S* media_type S* [ AND S* expression ]* has the interesting (boring?) consequence that media_type allows "only" and "not", which means that, according to the formal grammar, a small amount of backtracking (not sure if I am using the right word here) is required. I see three options to address this spec-implementation mismatch. A. Ask spec to change to match what Firefox implements. I'm pretty sure that other browsers do what Firefox does here (but I'll attach testing results in a minute). Also, if this section is rewritten in a state-machine-based approach, it is likely to be what's implemented. B. Change our implementation to accept "only" and "not" as media type. C. Change the spec and the implementation to disallow "and" as media type. I am opposed to this as it requires redundant check to make sure the media type isn't "and". The effect of this is only observable via CSSOM.
Reporter | ||
Comment 1•13 years ago
|
||
(In reply to Kang-Hao (Kenny) Lu [:kennyluck] from comment #0) > A. Ask spec to change to match what Firefox implements. I forgot to mention that what Firefox does currently is that it disallows "and" and "only" as media type when it is *not* preceded by "and" or "not". > I'm pretty sure that other browsers do what Firefox does here (but I'll > attach testing results in a minute). So IE9 implements what Firefox does. Opera12alpha and Chromium nightly implement C. (The test case doesn't work for Chromium because it doesn't seem to parse <style> with @media that doesn't match :( and also it doesn't implement the "Malformed media query" => "drop until ','" rule :(. A dangling "and" is dropped along with the whole at-rule.)
Reporter | ||
Comment 2•13 years ago
|
||
Reporter | ||
Comment 3•13 years ago
|
||
This is admittedly quite crappy.
Assignee | ||
Comment 4•12 years ago
|
||
Did you raise this on www-style? I think that's worth doing.
Reporter | ||
Comment 5•12 years ago
|
||
Yes. Florian's opinion[1] seems to be B. (for which I have a patch too), but using author's point of view for these kinds of corner situations doesn't make sense to me... I am not eager to pursue any way so I'll let you decide what to do here. We might as well just postpone this until someone bothers to submit a testcase. [1] http://lists.w3.org/Archives/Public/www-style/2012May/0955
Updated•12 years ago
|
Keywords: dev-doc-needed
Assignee | ||
Comment 6•12 years ago
|
||
I think my preference is actually option D: http://lists.w3.org/Archives/Public/www-style/2013May/0658.html But I think this is relatively low priority, and we should wait for the spec to settle before moving. (Sorry to take so long to get to this, again.)
Assignee | ||
Comment 7•11 years ago
|
||
The CSS WG resolved in yesterday's teleconference: http://krijnhoetmer.nl/irc-logs/css/20130529#l-326 (minutes soon, hopefully) to accept my proposal (D) in http://lists.w3.org/Archives/Public/www-style/2013May/0658.html
Assignee | ||
Comment 8•11 years ago
|
||
Comment on attachment 626144 [details] [diff] [review] Option A - this patch adds some tests for the current behavior That means these two tests: >+ query_should_be_parseable("and"); >+ query_should_be_parseable("not not"); and this test: >+ query_should_be_parseable("and and (orientation)"); are no longer correct, and code changes are required. (Should be 'not'.) Are you interested in fixing the code here, or should I?
Attachment #626144 -
Flags: review?(dbaron) → review-
Assignee | ||
Updated•11 years ago
|
Summary: Decide whether media query parsing should accept "not", "only" and "and" as media_type → media query parsing should reject all uses of "not", "only", "and", and "or" as media_type
Assignee | ||
Comment 9•11 years ago
|
||
Minutes of decision at http://lists.w3.org/Archives/Public/www-style/2013May/0783.html
Assignee | ||
Updated•11 years ago
|
Assignee: kennyluck → dbaron
Assignee | ||
Comment 10•11 years ago
|
||
Attachment #763128 -
Flags: review?(cam)
Comment 11•11 years ago
|
||
Comment on attachment 763128 [details] [diff] [review] Reject uses of reserved 'not', 'only', 'and', and 'or' as a media type. Review of attachment 763128 [details] [diff] [review]: ----------------------------------------------------------------- r=me
Attachment #763128 -
Flags: review?(cam) → review+
Assignee | ||
Comment 12•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/68eed79362f7
Comment 13•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/68eed79362f7
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
Updated•11 years ago
|
Whiteboard: [DocArea=CSS]
Comment 14•10 years ago
|
||
Doc updated: https://developer.mozilla.org/en-US/Firefox/Releases/24 I don't think it is worth a mention in the main text.
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•