jQuery :visible Bug

Pottering around with jQuery I spent a couple of hours trying to figure out why alternating row styles weren't working for hidden rows correctly.  For the life of me I couldn't figure it out, I had done every test imaginable without any results.  The selector $("tr:visible:even") didn't work correctly, certain rows were having the wrong class applied to them, despite working in a clean environment.  When I face a problem for a number of hours I eventually think to myself "why not try the inverse?", so I did just that.  $("tr:not(:hidden):even") did exactly what I wanted.  Strange you say? Indeed it is.  I can't help but think the inverse of visible isn't equivalent to hidden.  This may highlight the difference between display:none and visibility:none, I'm not certain.

Anyway, the problem was overcome as mentioned in case you face this issue.  This applies to 1.3 I believe.

Tags:

Leave a comment