How Stylo Matches CSS Selectors

I have long been interested in CSS selector matching algorithms . In short: existing selector matching algorithms are \(O(d^2)\) at worst, where \(d\) is the tree depth, and there are better algorithms that are \(O(d)\). But of course the constants matter a lot. I previously described both algorithms, and even showed that the bad cases can occur in practice. Recently I dove into the Stylo CSS…