Skip to content

I can not use the custom tag "ALL" with :extend #2219

Open

Description

@blooddy

:extend( some_selector all )

whether there is the possibility of using the pseudo selector :-less-all ???

example:

&:extend( some_selector:-less-all )

Activity

  1. matthew-dean commented on Oct 9, 2014

    @matthew-dean
    Member

    Interesting. It might have been better to designate extend flags with ! similar to !important, which is a bit more consistent with CSS. We could allow either ! or without for extend keywords for backwards compatibility. As in:

    :extend( some_selector all ) 
    //or
    :extend( some_selector !all ) 
    

    And then maybe optionally offer a --strict-flags option. Obviously the short-term solution is to not use or extend a selector that is also a keyword. With "custom elements" in HTML5, elements are required to be hyphen-separated, so it's not up to spec (but that doesn't mean you can't do it, or use "all" as a tag for other formats that use CSS).

  2. changed the title [-]I can not use the custom tag "ALL"[/-] [+]I can not use the custom tag "ALL" with :extend[/+] on Oct 9, 2014
  3. lukeapage commented on Oct 10, 2014

    @lukeapage
    Member

    It might work if you refer to that tag with a capital in.. the keyword is
    case sensitive and I think the tag isn't.. I'm just not sure if the extend
    matching works case insensitive (it should).
    E.g.

    extend( selectors ALL)

  4. seven-phases-max commented on Oct 10, 2014

    @seven-phases-max
    Member

    It might work if you refer to that tag with a capital in.

    Nope, curiously extend is case-sensitive currently (so .X does not match .x), probably we need another ticket for this bug :)

  5. lukeapage commented on Oct 10, 2014

    @lukeapage
    Member

    I think this use case is unusual so if we can fix extend to be case
    insensitive and keep the keyword sensitive it would be an ok permanent
    workaround?

  6. blooddy commented on Oct 11, 2014

    @blooddy
    Author

    The fact that the situation is not similar to the situation with !important.
    The parameter passed to the :extend is selector.
    For backward compatibility, you can leave both.
    Mark as deprecated and remove a couple of years.

  7. blooddy commented on Oct 11, 2014

    @blooddy
    Author

    the use of "!" not recommended, as it is likely that this character will be used in the following specifications css.

    http://www.smashingmagazine.com/2013/01/21/sneak-peek-future-selectors-level-4/

    I think that in all structures less better to stick to the standard syntax css, that there were no conflicts.

  8. seven-phases-max commented on Oct 11, 2014

    @seven-phases-max
    Member

    I like the approach suggested by @LukePage. :extend(All) could be a slick workaround. Also I guess some alternative "more CSS safe" keyword like --less-all would make sense too, but w/o removing current all. As a user I do not use any all tags in my projects and I definitely don't want to type --less-all where I can go with just all...
    (Looking forward I'm just scared a bit of being forced to use something like :extend(.clearfix --less-deep --less-scoped) :)

  9. matthew-dean commented on Oct 11, 2014

    @matthew-dean
    Member

    @blooddy It still doesn't look like it would conflict, if ever adopted, based on positioning in relation to the selector and whitespace. I originally was against ! for flags in Less but without it, our flags look like selectors.

    That said, I'm also for this case-insensitive short-term solution.

  10. lukeapage commented on Oct 11, 2014

    @lukeapage
    Member

    and to expand my opinion, I agree with previous conversation that maybe we got it wrong with the flags. I'll look at changing extend to be case insensitive.

  11. lukeapage commented on Oct 11, 2014

    @lukeapage
    Member

    Interestingly selectors case-sensitivity depends on the document that is applying the css. So in strict mode in html, class and attribute selectors are case sensitive, whilst tag names are case insensitive. However if the document is xml and not html, then the tag names are also case sensitive...

    It seems if I make extend case insensitive it should at least only apply to tag names..

  12. lukeapage commented on Oct 11, 2014

    @lukeapage
    Member

    And its a hell of a work to detect if "tag" is a tag in this case

    .a & { tag { } }
    

    Do people still think its a good idea to make it case insensitive?

    The easy fix is in extend visitor

        isElementValuesEqual: function(elementValue1, elementValue2) {
            if (typeof elementValue1 === "string" || typeof elementValue2 === "string") {
                return elementValue1 === elementValue2;
            }
    ...
    

    becomes

        isElementValuesEqual: function(elementValue1, elementValue2) {
            if (typeof elementValue1 === "string" || typeof elementValue2 === "string") {
                if (elementValue1[0] !== ".") {
                    elementValue1  = elementValue1.toLowerCase();
                    elementValue2  = elementValue2.toLowerCase();
                }
                return elementValue1 === elementValue2;
            }
    ...
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions