Skip to content

Variable selector "string" improperly parses comma #1421

Closed
@scottgit

Description

@scottgit

This StackOverflow question lead me to test what I thought would work, but failed. Namely, this example:

@inputs: input[type=text], input[type=email], input[type=password], textarea;

@{inputs} {
  &:focus {/*properties*/}
} 

Did not produce what was expected, as it failed to recognize the commas as separators of individual selectors. So instead of this expected output:

input[type=text]:focus,
input[type=email]:focus,
input[type=password]:focus,
textarea:focus {
  /*properties*/
}

It produced this unexpected output of just adding the :focus on the end of the whole variable value:

input[type=text], input[type=email], input[type=password], textarea:focus {
  /*properties*/
}

If the variable interpretation for selectors uses the same algorithm as when a variable is in a string, I can see "why" it is doing it that way, but it would seem to me that, at least for the case of the , in CSS, the variable interpretation needs to recognize it is dealing with a selector at that point, and should then take the next step and parse each of the commas to separate selectors, so that all nested uses of & will attach to all the appropriate selector strings.

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