Bug Tracker

Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#7234 closed bug (duplicate)

$(selector).not(':has[attribute]') don't work in IE 6-9

Reported by: pinal Owned by: john
Priority: blocker Milestone:
Component: selector Version: 1.4.3
Keywords: 1.7-discuss Cc:
Blocked by: #5637 Blocking:

Description

Code like this : $('tr').not(':has([colspan])') fine works in not IE browsers, but don't work in IE

Change History (29)

comment:2 Changed 9 years ago by snover

Component: unfiledselector
Milestone: 1.51.4.4
Priority: undecidedhigh
Status: newopen
Version: 1.4.21.4.3

Still an issue in 1.4.3.

comment:3 Changed 9 years ago by snover

Priority: highblocker

comment:4 Changed 9 years ago by snover

Milestone: 1.4.41.4.5

Retargeting due to severity of regressions in 1.4.3.

comment:5 Changed 9 years ago by snover

Milestone: 1.4.51.4.4

Retargeting for 1.4.4 as per John’s request.

comment:6 Changed 9 years ago by tomgrohl

I'm a bit confused as to why this is a bug. I think IE is correct with this ( for once ). Unless you meant td and not tr.

tr's doesn't have the colspan attribute
td's always has a colspan value, even if you don't set it (defaults to 1)

Which might be why you were gettings those results.

I did some alternative code to getting a tr where the child td's don't have a colspan (or in my case, have a colspan > 1) here (tested in FF, Chrome, Safari and IE 6,7,8,9)

Last edited 9 years ago by tomgrohl (previous) (diff)

comment:7 Changed 9 years ago by pinal

I made a misprint in a header:) But:

$('tr').not(':has([colspan])')

Such code means: "Get tr which don't have td with colspan attribute". It's a bug because it works fine in not IE browsers and 'has' can accept a selector in jQuery 1.4.* and '[colspan]' is a CSS 2.1 selector.

comment:8 in reply to:  7 ; Changed 9 years ago by tomgrohl

Replying to pinal:

I made a misprint in a header:) But:

$('tr').not(':has([colspan])')

Such code means: "Get tr which don't have td with colspan attribute". It's a bug because it works fine in not IE browsers and 'has' can accept a selector in jQuery 1.4.* and '[colspan]' is a CSS 2.1 selector.

Yeah that what I thought, I've tried:

$('tr').not('td:has([colspan])') //doesn't work at all

And

//doesn't work in IE 6, 7 and 8 ( Works In non IE browsers and IE9)
$('tr').not('td').has('[colspan]') 

Example here:

Maybe because colspan defaults to 1 if it is not set IE says it is anyway.

comment:9 in reply to:  8 ; Changed 9 years ago by pinal

I want to get such table rows by selector. I think $('tr').not(':has([colspan])') is right in selectoin syntax. May be this bug is duplicate of another one, but such selectoion must work.

comment:10 in reply to:  9 Changed 9 years ago by tomgrohl

Replying to pinal:

I want to get such table rows by selector. I think $('tr').not(':has([colspan])') is right in selectoin syntax. May be this bug is duplicate of another one, but such selectoion must work.

Yes I agree. Although to me

$('tr').not(':has([colspan])') 

should be

$('tr').not('td:has([colspan])') 

to be syntactally correct, I may be wrong.

Both the examples I've gave should really work, as they are the same technically, but only one does.

comment:11 Changed 9 years ago by john

Owner: set to john
Status: openassigned

comment:12 Changed 9 years ago by anonymous

I just was struck by this problem in a project of mine, and created a small fiddle of it, and afterwards searched the bugtracker and found this. Bad choice =)

Anyway, I created the fiddle so I give it to you:

http://www.jsfiddle.net/wailqill/jW5CZ/

Works in ff, not in ie. No matter what version of jQuery.

comment:13 Changed 9 years ago by snover

Milestone: 1.4.41.4.5

Retargeting to next minor release.

comment:14 Changed 9 years ago by MrTyzik

IE appears to be behaving differently in jsFiddle vs. true operation.

Here it thinks all td elements have a colspan, it even picks them up in CSS: http://jsfiddle.net/MrTyzik/DSVeg/4/

However outside jsFiddle things match Chrome for me in IE9 beta: http://csh.rit.edu/~ryanw/chaos/ie9-colspan.html

I haven't tried true IE8 or below yet.

Please note the colspan_not_one test at the end though using $('td[colspan!=1]'). In this case, IE does not match FF or Chrome. That feels like a related but different issue.

comment:15 Changed 9 years ago by john

Milestone: 1.4.51.6

This is getting moved to 1.6 for when the $.attr happens.

comment:16 Changed 9 years ago by john

Milestone: 1.61.next

comment:17 Changed 9 years ago by timmywil

Blocked by: 5637 added

comment:18 Changed 8 years ago by john

Keywords: 1.7-discuss added

Nominating ticket for 1.7 discussion.

comment:19 Changed 8 years ago by Rick Waldron

+1, Seems like a bug, should be fixed

comment:20 Changed 8 years ago by jaubourg

+0,

comment:21 Changed 8 years ago by timmywil

+1, Sizzle attributes again

comment:22 Changed 8 years ago by ajpiano

+1, Buggers

comment:23 Changed 8 years ago by john

+1, Probably due to attribute camelCase, timmywil and I can fix this.

comment:24 Changed 8 years ago by scottgonzalez

+1, also, .hasAttr() might be nice

comment:25 Changed 8 years ago by jzaefferer

+1

comment:26 Changed 8 years ago by dmethvin

Milestone: 1.next1.7

comment:27 Changed 8 years ago by john

Resolution: duplicate
Status: assignedclosed

comment:28 Changed 8 years ago by john

Duplicate of #5637.

comment:29 Changed 8 years ago by dmethvin

Milestone: 1.7
Note: See TracTickets for help on using tickets.