Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 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 12 years ago by snover

Blocked by: 5637 added
Component: unfiledselector
Priority: undecidedhigh
Status: newopen

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

comment:3 Changed 12 years ago by Timmy Willison

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

comment:4 Changed 12 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 12 years ago by Timmy Willison

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

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

Milestone: 1.61.next

comment:8 Changed 12 years ago by Timmy Willison

Summary: parents('[attr]') returns nothing if attr is present but has no value$('[attr]') returns nothing if attr is present but has no value

comment:9 Changed 12 years ago by Timmy Willison

Summary: $('[attr]') returns nothing if attr is present but has no value$('[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 12 years ago by Timmy Willison

#9159 is a duplicate of this ticket.

comment:11 Changed 12 years ago by john

Resolution: duplicate
Status: openclosed

comment:12 Changed 12 years ago by john

Duplicate of #5637.

Note: See TracTickets for help on using tickets.