Skip to content

Conversation

@frivoal
Copy link
Collaborator

@frivoal frivoal commented Jun 14, 2016

This fixes a mistake introduced in 2f37630

Not only can you not have or and and at the same level, but not is handled the same as well, and also needs extra parentheses.

@frivoal
Copy link
Collaborator Author

frivoal commented Jun 14, 2016

Making this into a pull request rather than fixing it directly on the chance that I'm wrong. I'm pretty sure of this, but then again you should know it pretty well as well, so maybe I missed something somewhere.

@tabatkins
Copy link
Member

Hmmmm. I'd prefer if we could do "not" at the same level as the others, but I suppose I'd need to see what browsers actually do with and/not today. Your change is indeed correct for what @dbaron wrote in Conditional, tho.

@frivoal
Copy link
Collaborator Author

frivoal commented Jun 14, 2016

And for the grammar that you have in the MQ spec as well. I think the decision was not to have any implied operator priority, and keep it fully explicit always, to make sure there's not apparent ambiguity. Not sure why you think it is less important for not than for and vs or.

@tabatkins
Copy link
Member

Because "not" is unary, and "and" and "or" are binary; it's very standard for unary operators to either have very high or very low binding strength, whichever is most useful in context (and in this case I think it's obvious it would have high binding, like it does in other programming languages), but it's usually difficult to predict which of two binary operators have higher precedence.

@frivoal
Copy link
Collaborator Author

frivoal commented Jun 15, 2016

I think it is pretty confusing with not as well. Binding strongly as in other languages sounds reasonable at first, but then you have to consider that in the legacy syntax @media not screen and (width: 12345px) {...} it binds more weakly than and.

Morality: don't guess, and stick parentheses in there, which is why we resolved to require them. (Can't find the link right now, but I am pretty sure we have a resolution a few years back).

@tabatkins
Copy link
Member

Yeah, that's reasonable.

@tabatkins tabatkins merged commit b695579 into w3c:master Jun 15, 2016
@simevidas
Copy link
Contributor

simevidas commented Jun 16, 2016

@frivoal @media not screen and … is legacy syntax? Is this an upcoming change? The spec example in ch. 2.2.1. uses it normally.

@frivoal
Copy link
Collaborator Author

frivoal commented Jun 16, 2016

@simevidas By legacy, I did not mean something to be phased out. I meant what we've had so far, as opposed to this new boolean logic that is (relatively) newly being introduced.

@fantasai
Copy link
Collaborator

fantasai commented Aug 2, 2016

On 06/14/2016 10:55 PM, Florian Rivoal wrote:

I think it is pretty confusing with |not| as well. Binding strongly as in other languages sounds reasonable at first, but then
you have to consider that in the legacy syntax |@media not screen and (width: 12345px) {...}| it binds more weakly than |and|.

Morality: don't guess, and stick parentheses in there, which is why we resolved to require them. (Can't find the link right
now, but I am pretty sure we have a resolution a few years back).

Given we've had media queries for awhile now, the correct thing
to do is whatever Media Queries Level 3 and its implementations
do. Anything else is likely to cause confusion, by having MQs
that work in new browsers but not old ones or vice versa.

~fantasai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants