Skip to content

selector matching should be specified as being from right to left, not left to right #720

@dbaron

Description

@dbaron

As discussed in today's teleconference, I'm opening this issue to cover an issue I raised in 2015:

The section on evaluating a selector introduces an algorithm that defines how selectors are matched. It does so by doing the matching from left to right (across combinators), which is the opposite of what all implementations that I'm aware of do.

Specifying it this way seems like a very bad idea, because it introduces a number of risks:

  1. specification authors might introduce features that are easy to describe in the spec's left-to-right matching but hard to implement in the implementations' right-to-left matching

  2. we might want to introduce features that are simple in the implementations' right-to-left matching, but that are hard to describe it the spec's right-to-left matching

  3. we might introduce features where it's easy to make subtle errors in the mapping between the two descriptions; this can lead to things that are technically bugs in implementations, and might even do so interoperably. It's better for these not to be bugs, and just to match the spec.

So I think that if the spec introduces an algorithmic description of selector matching (as the current draft of selectors-4 does), that algorithm should work the same way implementations work.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions