SimonSapin/lxml — comment on commit cf1d707c01fe5229759c09caa65517be1e5d0fbc
File:  line 0
By SimonSapin:

I initially did the check in `parse_simple_selector`, but that broke some other tests. (Maybe I just did it wrong.)

Then I just copied the "consumed == len(stream.used)" pattern that was already used later in `parse_selector`.

I wanted to fix my bug with minimal changes, but I agree that it would be better to let `parse_simple_selector` do this check itself. About the third usage of `parse_simple_selector`: it looks like it is for functional pseudo-classes. The selector grammar has an [expression](http://www.w3.org/TR/css3-selectors/#w3cselgrammar) production for what’s inside the parentheses, but it is not a selector nor a simple selector. I guess that part of the code needs a bit of work too.