docs: state that `pseudos` functions must be pure

Merged
FB
1h ago
+9-1

When matching a selector, css-select may reuse a cached result and skip calling a custom pseudo-class function again (with cacheResults, the default, it already does), so a pseudo-class function that keeps state between calls, or changes the document, can match differently.

The README and the option’s API documentation now state these requirements. Documentation only; no code change.

🤖 Generated with Claude Code, using Opus 5.5.

Summary by CodeRabbit

  • Documentation
    • Clarified that custom pseudo-class functions must be side-effect-free and return consistent results for the same element and arguments during a query, and across queries using the same compiled selector when result caching is enabled.
    • Noted that css-select may skip calling a custom pseudo-class function when it already knows the result.