Bug Tracker

Modify

Ticket #6407 (closed bug: worksforme)

Opened 4 years ago

Last modified 4 years ago

.eq() and tfoot

Reported by: simshaun Owned by:
Priority: Milestone: 1.4.3
Component: selector Version: 1.4.2
Keywords: Cc:
Blocking: Blocked by:

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

eq0_bug.html Download (1011 bytes) - added by simshaun 4 years ago.
Test case

Change History

comment:1 Changed 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

Can you reopen this ticket and attach an example of the problem?

Changed 4 years ago by simshaun

Test case

comment:2 Changed 4 years ago by simshaun

  • Status changed from closed to reopened
  • Resolution invalid deleted

Attached an example as requested.

comment:3 Changed 4 years ago by dmethvin

  • Status changed from reopened to closed
  • Resolution set to worksforme

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.

comment:4 Changed 4 years ago by simshaun

  • Status changed from closed to reopened
  • Resolution worksforme deleted

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.

comment:5 Changed 4 years ago by dmethvin

  • Status changed from reopened to closed
  • Resolution set to worksforme

There is no W3C standard for the :first selector, 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.

 http://forum.jquery.com

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.