Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify usage of initial vs combined #131

Open
simonsmith opened this issue Apr 11, 2018 · 2 comments
Open

Clarify usage of initial vs combined #131

simonsmith opened this issue Apr 11, 2018 · 2 comments

Comments

@simonsmith
Copy link
Collaborator

Some clearer code examples of what initial and combined are used for in the README would be very useful.

Relevant #130

@saulhardman
Copy link

Hi @simonsmith, to get this issue rolling (and to help me with another conundrum) could you describe/explain what the initial and combined component selectors are in the context of the following example?

.no-js .c-block .c-block__element {
  // ...
}

@simonsmith
Copy link
Collaborator Author

That selector is first broken up into sequences based on combinators. The CSS combinators matched against are " ", >, +, ~. The sequences for your selector are:

[".no-js", ".c-block", ".c-block__element"]

To recap the docs:

initial describes valid initial selector sequences — those occurring at the beginning of a selector, before any combinators
If you do not specify a combined pattern, it is assumed that combined sequences must match the same pattern as initial sequences.
In weak mode, any combined sequences are accepted, even if you have a combined pattern.

In your above example the initial is run on the .no-js. If you have not provided a combined then the initial is used for the combined and also run against .c-block and .c-block-element

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants