Bug Tracker

Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#7555 closed bug (duplicate)

Incorrect .is() behavior when checking for attribute with no value

Reported by: alexanderkahn@… Owned by:
Priority: low Milestone: 1.next
Component: selector Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

Description

Given this markup:

<div data-hi></div> <div data-hi></div>

Running this code:

$('div').is('[data-hi]');

should return true, since .is() returns true if any member of the collection matches its query. But it returns false.

This is illustrated here: http://jsfiddle.net/ujP2Y/8/

See also #5930.

Change History (6)

comment:1 Changed 6 years ago by Alex Kahn <alexanderkahn@…>

Note that this bug only happens if the there are multiple elements in the collection matching the attribute query. If just one element has the attribute, .is() works as expected.

comment:2 Changed 6 years ago by rwaldron

  • Component changed from unfiled to selector
  • Milestone changed from 1.5 to 1.4.5
  • Priority changed from undecided to low
  • Status changed from new to open

comment:3 Changed 6 years ago by ajpiano

This fiddle illustrates just how anomalous this is, for anyone who is curious. http://jsfiddle.net/ajpiano/qUwL7/

comment:4 Changed 6 years ago by jitter

Same test as by ajpiano but more browsers tested http://www.jsfiddle.net/jitter/CnJPA/

comment:5 Changed 5 years ago by john

  • Resolution set to duplicate
  • Status changed from open to closed

comment:6 Changed 5 years ago by john

Duplicate of #5637.

Note: See TracTickets for help on using tickets.