Bug Tracker

Modify

Ticket #7234 (closed bug: duplicate)

Opened 3 years ago

Last modified 20 months ago

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

Description

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

Change History

comment:2 Changed 3 years ago by snover

  • Priority changed from undecided to high
  • Status changed from new to open
  • Version changed from 1.4.2 to 1.4.3
  • Component changed from unfiled to selector
  • Milestone changed from 1.5 to 1.4.4

Still an issue in 1.4.3.

comment:3 Changed 3 years ago by snover

  • Priority changed from high to blocker

comment:4 Changed 3 years ago by snover

  • Milestone changed from 1.4.4 to 1.4.5

Retargeting due to severity of regressions in 1.4.3.

comment:5 Changed 3 years ago by snover

  • Milestone changed from 1.4.5 to 1.4.4

Retargeting for 1.4.4 as per John’s request.

comment:6 Changed 3 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 3 years ago by tomgrohl (previous) (diff)

comment:7 follow-up: ↓ 8 Changed 3 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 ; follow-up: ↓ 9 Changed 3 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 ; follow-up: ↓ 10 Changed 3 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 3 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 3 years ago by john

  • Owner set to john
  • Status changed from open to assigned

comment:12 Changed 3 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 3 years ago by snover

  • Milestone changed from 1.4.4 to 1.4.5

Retargeting to next minor release.

comment:14 Changed 3 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 2 years ago by john

  • Milestone changed from 1.4.5 to 1.6

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

comment:16 Changed 2 years ago by john

  • Milestone changed from 1.6 to 1.next

comment:17 Changed 2 years ago by timmywil

  • Blocked by 5637 added

comment:18 Changed 2 years ago by john

  • Keywords 1.7-discuss added

Nominating ticket for 1.7 discussion.

comment:19 Changed 2 years ago by rwaldron

+1, Seems like a bug, should be fixed

comment:20 Changed 2 years ago by jaubourg

+0,

comment:21 Changed 2 years ago by timmywil

+1, Sizzle attributes again

comment:22 Changed 2 years ago by ajpiano

+1, Buggers

comment:23 Changed 2 years ago by john

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

comment:24 Changed 2 years ago by scott.gonzalez

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

comment:25 Changed 2 years ago by jzaefferer

+1

comment:26 Changed 23 months ago by dmethvin

  • Milestone changed from 1.next to 1.7

comment:27 Changed 23 months ago by john

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

comment:28 Changed 23 months ago by john

Duplicate of #5637.

comment:29 Changed 20 months ago by dmethvin

  • Milestone 1.7 deleted

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.