I have long been interested in CSS selector matchingalgorithms. 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 engine, used by Firefox, to better understand exactly how it works and better understand the constraint...