Bug Tracker

Ticket #7485 (closed bug: fixed)

Opened 5 years ago

Last modified 4 years ago

Inconsistency between has [attribute] selector and attr() method

Reported by: jitter Owned by:
Priority: blocker Milestone: 1.6
Component: attributes Version: 1.5.2
Keywords: Cc:
Blocking: Blocked by:


While checking on #7480 I noted a related bug.

There are inconsistencies when using the has [attr] selector and the attr() method.
The selector doesn't return all elements which have the attribute although upon checking with the attr() method it returns a value.

 test case with text attribute not explicitly defined
 test case with text attribute explicitly defined on some elements

Change History

comment:1 Changed 5 years ago by snover

  • Priority changed from undecided to blocker
  • Status changed from new to open
  • Component changed from unfiled to attributes
  • Blocked by 7128 added

This is something on the roadmap for 1.5. .attr will be rewritten along with Sizzle to stop matching on the DOM properties, so this will all be happily consistent again.

You will probably also notice here that the first test case will behave differently in IE6/7 because they run through Sizzle.

Last edited 5 years ago by snover (previous) (diff)

comment:2 Changed 5 years ago by john

  • Milestone changed from 1.5 to 1.6

This is getting moved to 1.6 for when the $.attr happens.

comment:3 Changed 5 years ago by timmywil

I think #7128, #5930, and #5637 are duplicates of this issue, but I'm not 100% on that.

comment:4 Changed 4 years ago by timmywil

  • Blocked by 7128 removed

comment:4 Changed 4 years ago by timmywil

  • Status changed from open to closed
  • Version changed from 1.4.4 to 1.5.2
  • Resolution set to fixed

The nodes in question do not have content attributes called "text" and therefore should not be found by either one.  http://jsfiddle.net/timmywil/znVBU/2/

Note: See TracTickets for help on using tickets.