It’s slower but, assuming you have control over page content, I’d think the answer is probably pseudo selectors or sibling selectors. The more complex stuff really.
Of course if that’s a need the page needs work but, not everything is “fixable” in time limited business cases.