You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
td:nth-child() counts grid columns, so a colspan or rowspan before the cell shifts it #528
td:nth-child() and th:nth-child() are matched against $this->mpdf->col, the cell's column in the grid, not its position among the cells of its row. td:first-child is not supported at all, even in tables.
Measured on gravitypdf at b6a07921, PHP 8.5.4.
Rule
Row
Browser
mPDF
td:nth-child(2) {color:green}
<td colspan="2">a</td><td>X</td>
X green
X black
td:nth-child(3) {color:red}
<td colspan="2">a</td><td>X</td>
X black
X red
td:nth-child(1) {color:green}
<td>X</td>, in the row under a rowspan="2" cell
X green
X black
td:first-child {color:green}
<td>X</td><td>b</td>
X green
X black
Fix. Count the cells opened in the current row inside Td, and match td/th:nth-child against that count. Treat :first-child on td, th and tr as :nth-child(1). This needs no stack of open elements; #538 later counts every element this way.
Tests. A colspan and a rowspan before the cell, header and footer rows, and :first-child.
Activity