Beginning on October 25th, 2016, Persona will no longer be an option for authentication on BMO. For more details see Persona Deprecated.
Last Comment Bug 780060 - implement CSSSupportsRule::conditionText
: implement CSSSupportsRule::conditionText
Product: Core
Classification: Components
Component: CSS Parsing and Computation (show other bugs)
: Trunk
: All All
: -- normal with 1 vote (vote)
: ---
Assigned To: Cameron McCormack (:heycam)
: Jet Villegas (:jet)
Depends on: 753517 914072
  Show dependency treegraph
Reported: 2012-08-02 18:56 PDT by Cameron McCormack (:heycam)
Modified: 2013-09-09 02:46 PDT (History)
2 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description Cameron McCormack (:heycam) 2012-08-02 18:56:54 PDT
The spec grew a conditionText IDL attribute on CSSSupportsRule.  That should be easy to expose since we already record it.
Comment 1 Cameron McCormack (:heycam) 2012-08-02 21:32:07 PDT
I'm trying to implement the setter.  From inside CSSSupportsRule::SetConditionText, how do I get the document to restyle after I update the condition?
Comment 2 Boris Zbarsky [:bz] (still a bit busy) 2012-08-02 22:56:38 PDT
Watch out for that "serializing" bit in the spec.  Worth double-checking what that means in practice.

As far as getting the document, you could steal the GetDocument stuff from or I could just land the patch that's a part of, since it has reviews and all.  Let me know?
Comment 3 Cameron McCormack (:heycam) 2012-08-02 23:00:32 PDT
It would probably be good if the spec said to trim the white space from the condition before returning it, just like it's trimmed when assigning.

My serialized condition includes comments that appear just after the condition, but not any that appear between the "@supports" and the condition.  Does that sound right?
Comment 4 Cameron McCormack (:heycam) 2012-08-03 21:52:46 PDT
Sent mail to ask:
Comment 5 Cameron McCormack (:heycam) 2012-08-03 21:54:26 PDT
(In reply to Boris Zbarsky (:bz) [In and out Aug 1 - 10, out Aug 11-20] from comment #2)
> As far as getting the document, you could steal the GetDocument stuff from
> or I could
> just land the patch that's a part of, since it has reviews and all.  Let me
> know?

If you can land the patch that sounds good to me.
Comment 6 Boris Zbarsky [:bz] (still a bit busy) 2012-08-05 19:20:36 PDT
Landed on inbound.
Comment 7 Cameron McCormack (:heycam) 2012-08-05 19:25:37 PDT

From it looks like serialization based on the token stream rather than the input source string is what people want.  But I think I'll wait until the spec is clearer about the exact serialization before making any changes.
Comment 8 Cameron McCormack (:heycam) 2012-11-25 19:44:07 PST
I posted a patch in bug 814907 that includes an implementation of conditionText for @supports rules.  I still don't see any definition of exact serialisation in the spec; that patch just uses the same string that is included in the middle of cssText, i.e. the exact string that was in the style sheet between "@supports" and "{", with white space trimmed off both ends.
Comment 9 David Baron :dbaron: ⌚️UTC-7 2013-03-27 13:45:46 PDT says:

    The conditionText attribute (defined on the CSSConditionRule parent rule), on getting, must return the condition that was specified, without any logical simplifications, so that the returned condition will evaluate to the same result as the specified condition in any conformant implementation of this specification (including implementations that implement future extensions allowed by the general_enclosed exensibility mechanism in this specification). In other words, token stream simplifications are allowed (such as reducing whitespace to a single space or omitting it in cases where it is known to be optional), but logical simplifications (such as removal of unneeded parentheses, or simplification based on evaluating results) are not allowed. 

So what needs to happen for this bug?
Comment 10 Cameron McCormack (:heycam) 2013-03-27 20:40:08 PDT
If token stream simplifications are allowed by not required, then we don't need to do anything for getting, but we still need to implement setting it.
Comment 11 Cameron McCormack (:heycam) 2013-03-28 00:15:50 PDT
Just to confirm, if you assign "(color: green" to conditionText, this should throw, right?
Comment 12 David Baron :dbaron: ⌚️UTC-7 2013-03-28 13:47:25 PDT
According to it shouldn't.  But if you think it should, it's worth raising as an issue on www-style.  (I don't have much of an opinion, although I am slightly inclined towards thinking it should throw.  Tab wrote that part of the spec, I think.)
Comment 13 Cameron McCormack (:heycam) 2013-03-28 22:21:43 PDT
Oh right.  I asked the wrong question then.  I should have asked: if you assign "(color: green" to conditionText, this will result in nothing being done, right?  And that's because it doesn't match the grammar for supports_condition.  On the other hand, CSS.supports() says to parse its argument as a supports_condition, which I take to mean that the regular CSS parser inference of missing closing parentheses at the end of input happens.

Am I interpreting correctly?
Comment 14 David Baron :dbaron: ⌚️UTC-7 2013-03-28 22:35:24 PDT
I don't think that difference was intended.  I think the parsing rules should be assumed to be the same, and following normal CSS rules in both cases.  And we should probably fix the spec.

Note You need to log in before you can comment on or make changes to this bug.