Vixen
02b45cc4
csharp
public sealed class SelectorMatcher

Decides whether a selector matches an element.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Right to left, which is the opposite of how a selector reads and the only way to do it at speed. .sidebar .row .cell read left to right means finding every .sidebar, then every .row under it, then every .cell under that — work proportional to the document. Read right to left it means: is this element a .cell? Almost always no, and the answer costs one test. Every browser does this.

The ancestor bloom is checked before any descendant combinator is walked, so a rule whose ancestor part cannot possibly be present costs two loads instead of a climb to the root.

Backtracking is real and is not avoided: a b c may find a b that has no a above it and have to keep climbing. Child and next-sibling combinators do not backtrack, because they have exactly one candidate.

Methods (2)

Used by (5)

  • SelectorMatchingTestsVixen.Ui.Styling.Tests
  • SelectorQueryVixen.Ui.Testing
  • StyleEngineVixen.Ui.Styling
  • StyleFixtureVixen.Ui.Styling.Tests
  • StyleResolverVixen.Ui.Styling