jQuery :first and tbody does not play well
I've created a
bug report already for this, but apparently I wasn't getting through to him.
The problem:
According to W3C specs, a <tfoot> tag must come BEFORE any <tbody> tags in a table. However, when rendered on screen, the contents of the <tfoot> tag are placed AFTER the <tbody> tags. Of course the <tfoot> can be absolutely positioned and moved around using CSS, but really, who does that? I'd say the majority don't.
Now lets say I have an input box inside of <tfoot> and an input box inside of <tbody>, and those are the only two inputs. $("input:first") or $("input").eq(0) will select the input in <tfoot> since it comes first in the DOM. This is where the problem occurs.
What if I want to focus on the first input on a page and the only two inputs are the one in <tfoot> and the one in <tbody>? The one in <tfoot> is going to be focused, even though the one in <tbody> comes first when viewing the page.
As I've already stated, I understand that the <tfoot> element comes first in the DOM, but I think that an exception should be made so that :first or .eq(0) returns elements within the same table's <tbody> tags first.
---
If you think my suggestion is stupid, I'm willing to accept solutions on how to accomplish focusing on the first input on a webpage in this situation without disregarding the tfoot tag in general or causing my HTML to be malformed.