Selecting only `td` elements from the root table (not nested tables inside the root table)
Hey! i have a ref to a table element and I want to querySelectorAll its td in a certain index. I came up with the following:
it works very nicely but it also selects
td
elements from nested drawer tables, (which are basically the same table inside a certain tr
).
I want to select only the td
s of the root table.
Can someone assist me? i'm open to JS and CSS solutions4 Replies
tr
elment with nested table can be identified because it has a data-state="open"
attributeif they can be identified like that, could you do
tbody tr:not([data-state="open") td:nth-child(${index + 1})
I think its a step into the solution but it doesn't work. because the inner table is the same table so it still has
tr > table > **tbody > tr > td**
like the root table.
I guess the only way to determine a row in the inner table from the outer table is that it has 2 parent tables instead of one?
not sure if theres a css selector for taht @Y7YAyou can use
:has
for that type of selection