LVel / ie7-js

Automatically exported from code.google.com/p/ie7-js
0 stars 0 forks source link

IE7._indexOf returns wrong index of tr/td/th #364

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

html:
<table>
  <tr><td>must be #fff</td></tr>
  <tr><td>must be #000</td></tr>
</table>
css:
tr:nth-of-type(odd){background:#fff}
tr:nth-of-type(even){background:#000}

What is the expected output? What do you see instead?
The backgrounds of first and second row must be #fff and #000, respectively, 
but result in #000 and #fff.

What version of the product are you using? On what operating system?
2.1 beta4

Please provide any additional information below.
To fix this issue, in IE7._indexOf
change
var index = element.sectionRowIndex;
to
var index = element.sectionRowIndex + 1;
change
index = element.cellIndex;
to
index = element.cellIndex + 1;

Since index of tr/td/th start at 0 not 1, but nth-of-type's counter starts at 1.

Original issue reported on code.google.com by luzi...@gmail.com on 12 Apr 2012 at 3:27