There are many tables, I want to set css style on first row of the table on case where first row has rowspan.
According this question, I find a way to set style. but there is a bug on case multi table.
Need to set style on first row and rowspan of it, just like this image:

Here is the script code:
document.querySelectorAll("table").forEach(table => {
let tr = table.getElementsByTagName("tr")[0];
let td = tr.getElementsByTagName("td")[0];
let rowspan = td.rowSpan ? td.rowSpan : 1;
var nodes = document.querySelectorAll(`tbody tr:nth-child(-n+${rowspan})`);
for (let i = 0; i < nodes.length; i++) {
nodes[i].style.background = "#1DA6C0";
}
});