Bug Tracker

Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#7770 closed bug (duplicate)

$('[attr]') returns nothing if attr is present but has no value in IE

Reported by: jcattley@… Owned by:
Priority: high Milestone: 1.next
Component: selector Version: 1.4.4
Keywords: Cc:
Blocked by: #5637 Blocking:

Description

<table data-foo data-bar='bat'>

<tr>

<td id='test'></td>

</tr>

</table>

console.log($('[data-foo]')); console.log($('#test').parents('[data-foo]')); console.log($('#test').parents('[data-bar]'));

returns

[<table>...] [] [<table>...]

http://jsfiddle.net/MLgXQ/

Change History (12)

comment:1 Changed 6 years ago by snover

  • Blocked by 5637 added
  • Component changed from unfiled to selector
  • Priority changed from undecided to high
  • Status changed from new to open

comment:2 Changed 6 years ago by murz

I think this is actually a bug with Sizzle.matches, see my pull request here: https://github.com/jeresig/sizzle/pull/54

I also opened a pull request with some regression tests for jQuery: https://github.com/jquery/jquery/pull/288

Last edited 6 years ago by murz (previous) (diff)

comment:3 Changed 6 years ago by timmywil

This is a duplicate of http://bugs.jquery.com/ticket/7369 and has been fixed in the recent changes to sizzle.

comment:4 Changed 6 years ago by murz

I'm not sure this is a dupe of that bug, and my regression tests still fail in the most recent version of Sizzle.

Also, it looks like the Sizzle repo just moved so my pull request is now here: https://github.com/jquery/sizzle/pull/54

comment:5 Changed 6 years ago by timmywil

No it's not. Sorry, I didn't update my comment.

comment:6 Changed 5 years ago by dmethvin

I closed [pull 288](https://github.com/jquery/jquery/pull/288) from murz to clear out clutter but please include them in the patch if they are useful.

comment:7 Changed 5 years ago by john

  • Milestone changed from 1.6 to 1.next

comment:8 Changed 5 years ago by timmywil

  • Summary changed from parents('[attr]') returns nothing if attr is present but has no value to $('[attr]') returns nothing if attr is present but has no value

comment:9 Changed 5 years ago by timmywil

  • Summary changed from $('[attr]') returns nothing if attr is present but has no value to $('[attr]') returns nothing if attr is present but has no value in IE

A selector with an attribute with no value seems to be the heart of multiple selector bugs.

comment:10 Changed 5 years ago by timmywil

#9159 is a duplicate of this ticket.

comment:11 Changed 5 years ago by john

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

comment:12 Changed 5 years ago by john

Duplicate of #5637.

Note: See TracTickets for help on using tickets.