Skip to main content

Bug Tracker

Side navigation

#7555 closed bug (duplicate)

Opened November 18, 2010 10:20PM UTC

Closed July 12, 2011 04:38PM UTC

Last modified July 12, 2011 04:38PM UTC

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

Reported by: alexanderkahn@gmail.com 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.

Attachments (0)
Change History (6)

Changed November 18, 2010 10:26PM UTC by Alex Kahn <alexanderkahn@gmail.com> comment:1

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.

Changed November 18, 2010 10:26PM UTC by rwaldron comment:2

component: unfiledselector
milestone: 1.51.4.5
priority: undecidedlow
status: newopen

Changed November 18, 2010 11:46PM UTC by ajpiano comment:3

This fiddle illustrates just how anomalous this is, for anyone who is curious.

http://jsfiddle.net/ajpiano/qUwL7/

Changed November 19, 2010 03:33PM UTC by jitter comment:4

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

Changed July 12, 2011 04:38PM UTC by john comment:5

resolution: → duplicate
status: openclosed

Changed July 12, 2011 04:38PM UTC by john comment:6

Duplicate of #5637.