Modern browsers support :nthchild(odd) and related CSS to stripe things in a variety of manners.
Older browsers, such as IE8, require you to add marker classes to the HTML.
In Moodle two independent systems are used, either "r0" and "r1", or "odd" and "even".
git grep -e r0 -e r1 -e even -e odd – *.css
Replacing these with newer CSS would slightly simplify the CSS and massively simplify the PHP that generates the corresponding HTML where the alternating output would no longer be required.
The question then remains as to what to do about IE8.
- You could just drop support for striped tables on IE8, since it's not a vital feature and support is technically not provided for IE8 any more.
- You could move all the IE8 specific CSS to an IE8 file that some themes (e.g. mobile themes, could exclude via the usual theme process)
- You could tag all the rules with .ie8 to make it easier for them to be discovered and removed later when we really stop supporting IE8
I'd vote for the first option, as the ability to stop worrying about IE8 when writing the PHP for such things makes the resulting code much shorter, simpler and clearer.
Note that there's a similar c0, c1, c2, c3 system for columns, but that's not really used for striping, so it's a separate issue.