You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
& combinator inside an escaped string selector #864
I guess the last implies that we "parse" the selector for use of & which I'm not sure I like since maybe thats why you are escaping it?
Am also thinking that if we go for (1) or (2) of supporting just & immediately before or & immediately after.. since that covers the main bases. what do you think?
Brackets are already required. I assume @cloudhead added it to make it very clear its not a selector.
I prefer the first, but I can see an issue being reported next month that wants & in the middle of the interpolated string.. then we can't remove the first option and have to additionally support the third second option.. but to take devils advocate, if we do option 3 we have to parse the string as a selector basically and I don''t like that idea. So I think I agree that option 1 is best.
The results look good, but the test cases are strange, since no one would do this:
.a{(~".b"){color: red;}}
I don't know if it was a big deal, but since this is about a syntax to allow string substitution, that might be the better example in the test. (Like @borodean's up top.) It just threw me for a sec.
+1 for syntax #1 -- but be aware that string escaping in selectors like that is an undocumented feature and therefore not recommended. It's highly probable that it will change. /cc @agatronic
I agree with the implementation comments, the existing syntax makes it a bit hacky.
Id rather depreciate the existing syntax and allow @{var} as an element.. e.g.
&.tst@{var}. {
color: black;
}
the existing syntax may not be documented in less documentation, but use in bootstrap and explanation on stack overflow mean lots of people are using it.
Hah. What if I want to output @{var} construction as is, with no evaluation? Consider it is some of kind of brand new css hack that may spring up some day.
Activity
matthew-dean commentedon Jul 18, 2012
What are you trying to output?
borodean commentedon Jul 18, 2012
Expected output:
matthew-dean commentedon Jul 18, 2012
Confirmed. That looks like a bug.
lukeapage commentedon Aug 16, 2012
Yes, there s no way round it.. @MatthewDL @Synchro @cloudhead what do you think is the best format
I guess the last implies that we "parse" the selector for use of & which I'm not sure I like since maybe thats why you are escaping it?
Am also thinking that if we go for (1) or (2) of supporting just & immediately before or & immediately after.. since that covers the main bases. what do you think?
Synchro commentedon Aug 17, 2012
Of those I think the first is the clearest.
borodean commentedon Aug 17, 2012
BTW, in LESS syntax, what does the brackets mean? I think it should be made clear before considering proper syntax.
lukeapage commentedon Aug 18, 2012
Brackets are already required. I assume @cloudhead added it to make it very clear its not a selector.
I prefer the first, but I can see an issue being reported next month that wants & in the middle of the interpolated string.. then we can't remove the first option and have to additionally support the third second option.. but to take devils advocate, if we do option 3 we have to parse the string as a selector basically and I don''t like that idea. So I think I agree that option 1 is best.
matthew-dean commentedon Aug 18, 2012
+1 to @Synchro . & should be on the outside, since it's not normally used within expressions. So option #1 looks correct. The others are weird.
borodean commentedon Aug 18, 2012
If we consider using & in the middle of the interpolated string and option 1 is prefferable, it may be done that way:
borodean commentedon Aug 18, 2012
Also, if for some weird reason we want to output & in selector as is:
We need to have an option to escape it somehow. Option 1 solves this clearly:
lukeapage commentedon Aug 19, 2012
@MatthewDL @Synchro @dmcass Can you take a look at the pull request and see if you agree with implementation.
@borodean the syntax in your last comment will not be supported - for reasons explained in the source of the pull request.
matthew-dean commentedon Aug 19, 2012
The results look good, but the test cases are strange, since no one would do this:
I don't know if it was a big deal, but since this is about a syntax to allow string substitution, that might be the better example in the test. (Like @borodean's up top.) It just threw me for a sec.
dmcass commentedon Aug 20, 2012
Agree with @MatthewDL, I feel like the test case could add a bit more complexity. Otherwise, looks good.
cloudhead commentedon Aug 21, 2012
+1 for syntax #1 -- but be aware that string escaping in selectors like that is an undocumented feature and therefore not recommended. It's highly probable that it will change. /cc @agatronic
cloudhead commentedon Aug 21, 2012
Looking at this again and looking at the proposed implementation - I would say no.
The feature is unsupported, and to be used "as-is" - the patch couples the selector parser with this feature and increases complexity for little gain.
👎
lukeapage commentedon Aug 21, 2012
I agree with the implementation comments, the existing syntax makes it a bit hacky.
Id rather depreciate the existing syntax and allow @{var} as an element.. e.g.
the existing syntax may not be documented in less documentation, but use in bootstrap and explanation on stack overflow mean lots of people are using it.
cloudhead commentedon Aug 21, 2012
Yes, let's do it that way and deprecate the
(~"")syntaxborodean commentedon Aug 21, 2012
Hah. What if I want to output @{var} construction as is, with no evaluation? Consider it is some of kind of brand new css hack that may spring up some day.
cloudhead commentedon Aug 21, 2012
Well, Mick Jagger says you can't always get what you want:
http://www.youtube.com/watch?v=WbjZA3aAH3s&feature=fvst
lukeapage commentedon Aug 21, 2012
@borodean
I think its highly unlikely for a css construct to use that form. No-ones complained yet about being unable to make a string with "@var" in it..
lukeapage commentedon Sep 9, 2012
pulled new selector interpolation format