CSS and jQuery alternatives

Created on 10 October 2012, about 12 years ago
Updated 9 March 2024, 10 months ago

This is just a note that there are much more reliable ways to achieve this than processing table mark-up with regular expressions.

jQuery provides even and odd selectors, so you can use that to deal with the problem at the DOM level:

http://api.jquery.com/odd-selector/

And you only need to utilise that approach for IE8 and below, as all modern browsers support the nth-child CSS selector which can be given even/odd arguments, and solve this problem purely at the CSS level:

http://stackoverflow.com/questions/5080699/using-css-even-and-odd-pseudo...

πŸ’¬ Support request
Status

Closed: outdated

Version

1.0

Component

Documentation

Created by

πŸ‡³πŸ‡ΏNew Zealand jweowu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡¦Ukraine AstonVictor

    I'm closing it because the issue was created a long time ago without any further steps.

    if you still need it then raise a new one.
    thanks

  • πŸ‡³πŸ‡ΏNew Zealand jweowu

    Hi there,

    This was only ever a Documentation task for the module's maintainers to note *somewhere* that there are some alternatives to using this module, but I don't see any notes to that effect on the current project page or in its readme file, and a glance at the code of version 2.0 indicates that it's still using regular expressions to parse table markup; so I think nothing has changed.

    Perhaps you could update the project page description to include the alternatives I described? If you did that, I'd consider this issue closed.

    (And honestly, 12 years later I imagine there's no reason not to use the nth-child CSS selector.)

Production build 0.71.5 2024