memory: a third way an instrument goes blind — nth-child vs nth-of-type
Credited to design-dev. His R2 order check has a positive control — one tile given order:-1 that the check must catch — and the control went blind when group headers became grid children: nth-child(5) started landing on a header rather than the fifth tile. Same class as the two defects already in this file. A control that no longer controls reads exactly like a passing test; nothing in the output distinguishes 'detected nothing because there was nothing' from 'detected nothing because I am aimed at the wrong element'. The rule: nth-of-type over nth-child wherever the assertion means the Nth TILE rather than the Nth child element. They agree until somebody adds a sibling of a different kind, and adding siblings is what a redesign is.
This commit is contained in:
@@ -48,3 +48,22 @@ rules (position, alphabetical, count) disagree.
|
||||
Whether it becomes `scripts/` is an open question for the operator — this repo
|
||||
has now been bitten by vacuous falsifiers three times, and prose in a memory
|
||||
file is not an instrument.
|
||||
|
||||
## A third way an instrument goes blind: `nth-child` vs `nth-of-type`
|
||||
|
||||
_Added 2026-09-23, credited to design-dev, who hit it in his R2 order check._
|
||||
|
||||
His layout check has a positive control — one tile given `order:-1` that the
|
||||
check must catch. **The control went blind when group headers became grid
|
||||
children**: `nth-child(5)` started landing on a header instead of the fifth
|
||||
tile, so the control stopped controlling and the check kept reporting clean.
|
||||
|
||||
Same class as this file's other two, and the reason it belongs here: **a control
|
||||
that no longer controls reads exactly like a passing test.** Nothing in the
|
||||
output distinguishes "detected nothing because there was nothing" from
|
||||
"detected nothing because I am aimed at the wrong element".
|
||||
|
||||
**The rule worth having written down:** use `nth-of-type` over `nth-child` for
|
||||
any assertion that means *the Nth TILE* rather than *the Nth child element*.
|
||||
The two agree right up until somebody adds a sibling of a different kind — and
|
||||
adding a sibling is what a redesign is.
|
||||
|
||||
Reference in New Issue
Block a user