Bug Tracker

Ticket #7770 (closed bug: duplicate)

Opened 4 years ago

Last modified 3 years ago

$('[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:
Blocking: Blocked by: #5637

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

comment:1 Changed 4 years ago by snover

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

comment:2 Changed 4 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 4 years ago by murz (previous) (diff)

comment:3 Changed 4 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 4 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 4 years ago by timmywil

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

comment:6 Changed 4 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 4 years ago by john

  • Milestone changed from 1.6 to 1.next

comment:8 Changed 4 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 4 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 4 years ago by timmywil

#9159 is a duplicate of this ticket.

comment:11 Changed 3 years ago by john

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

comment:12 Changed 3 years ago by john

Duplicate of #5637.

Note: See TracTickets for help on using tickets.