Side navigation
#6407 closed bug (worksforme)
Opened April 07, 2010 03:23PM UTC
Closed April 15, 2010 12:27AM UTC
.eq() and tfoot
Reported by: | simshaun | Owned by: | |
---|---|---|---|
Priority: | Milestone: | 1.4.3 | |
Component: | selector | Version: | 1.4.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
In a valid HTML structure, the <tfoot> tag must come before any <tbody> tags within a table. When rendered on screen, the <tfoot> is always placed at the bottom of the table.
The problem arises when there is an element within both the <tfoot> and <tbody> tags. eq(0) is expected to return the element within tbody, since its displayed first on the screen, but instead returns the element within tfoot, since it comes first in the HTML.
I guess this would also affect :first as well.
Also, I can't just disregard any elements within tfoot, because it may be possible that I need to select one within it. Its just when there is a tfoot and tbody, the element in a tbody tag needs to be returned before the element in tfoot.
Attachments (1)
Change History (5)
Changed April 10, 2010 11:36PM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
Changed April 12, 2010 03:01AM UTC by comment:2
resolution: | invalid |
---|---|
status: | closed → reopened |
Attached an example as requested.
Changed April 13, 2010 12:46AM UTC by comment:3
resolution: | → worksforme |
---|---|
status: | reopened → closed |
It's up to the person creating the document to create a valid html document. jQuery returns the elements in document order, so the result seems to be correct as shown. It doesn't really matter where the content appears on the page.
Changed April 13, 2010 11:43PM UTC by comment:4
resolution: | worksforme |
---|---|
status: | closed → reopened |
According to the W3 specs, tfoot must come before any tbody tags, so the example I posted is actually correct.
Just because jQuery returns the elements in document order does not mean its correct.
I'm open to any solutions that solve the problem if you aren't willing to even take a look at the bug, but as I see it, this is jQuery's problem.
Changed April 15, 2010 12:27AM UTC by comment:5
resolution: | → worksforme |
---|---|
status: | reopened → closed |
There is no W3C standard for the
:firstselector, it is defined by jQuery to be the first element in the matched set.
http://api.jquery.com/first-selector/
Since the matched set of elements is returned in document order, and the tfoot elements come before tbody, the example seems to be working fine. This would be similar to having a div at the end of a document absolutely positioned so that it appeared higher up the document. jQuery would still consider it to be near the end of the document, regardless of where it appeared visually.
If you disagree, feel free to plead your case on the forum.
Can you reopen this ticket and attach an example of the problem?