Skip to main content

Bug Tracker

Side navigation

#5930 closed bug (duplicate)

Opened January 26, 2010 04:05AM UTC

Closed April 15, 2011 04:12AM UTC

Last modified April 15, 2011 04:12AM UTC

$('[selected]') Has Attribute Selector failing in IE8

Reported by: miketaylr Owned by: john
Priority: blocker Milestone: 1.6
Component: selector Version: 1.4.4
Keywords: ie8 queryselectorall qsa sizzle attribute boolean Cc:
Blocked by: Blocking:
Description

Summary: $('[selected]') always fails in IE8 (but not ie6, or ie7)

It appears that IE8 has a bug in its querySelectorAll implementation, so I think Sizzle is just inheriting the problem here.

$('[selected=selected]) works, whereas $('[selected]') never does.

Here's a link to the qunit tests on "boolean" Has Attribute selectors: http://miketaylr.com/test/qunit/has_attribute_selector.html

Also, here's a simple test page on the IE8 QSA broken-ness:

http://miketaylr.com/test/ie8qsa.html

Attachments (0)
Change History (12)

Changed January 26, 2010 04:12AM UTC by john comment:1

milestone: 1.51.4.2
version: 1.41.4.1

Changed February 05, 2010 07:07PM UTC by john comment:2

resolution: → wontfix
status: newclosed

I think we're just recommending that people use :selected instead of [selected] in their code. Not only is it easier to use but it's also consistent across platforms.

Changed February 05, 2010 11:00PM UTC by john comment:3

resolution: wontfix
status: closedreopened

Didn't mean to close this, it's still something we want to tackle.

Changed November 19, 2010 01:04AM UTC by dmethvin comment:4

#5066 is a duplicate of this ticket.

Changed November 19, 2010 01:28AM UTC by jitter comment:5

milestone: 1.4.21.5

Changed November 21, 2010 04:08AM UTC by snover comment:6

#5918 is a duplicate of this ticket.

Changed November 21, 2010 04:10AM UTC by snover comment:7

keywords: ie8, qsa, Sizzleie8 queryselectorall qsa sizzle attribute boolean
priority: majorblocker
status: reopenedopen
version: 1.4.11.4.4

Changed January 14, 2011 06:48AM UTC by me@shanimal.com comment:8

Im using a content mgmt solution that spits in an extra title tag. To figure out what content I am including I have <title context="howc"></title>.

When I try var context = $("title[context]]").attr("context"); context is undefined.

Maybe because my <Title tag is in the wrong place (inside body) maybe because context is not a valid attribute of <Title?

I can clean this up and get something working, but I thought I'd add this to the bug. Thanks.

Changed January 14, 2011 06:58AM UTC by anonymous comment:9

I think IE stripped the tag out or something.

This doesn't work either:

var context;

$("title").each(function(){

if($(this).attr("context"))

context=$(this).attr("context");

})

alert(context);

undefined ie7

works in firefox

Changed January 17, 2011 04:51PM UTC by john comment:10

milestone: 1.51.6

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

Changed April 15, 2011 04:12AM UTC by timmywil comment:11

resolution: → duplicate
status: openclosed

Changed April 15, 2011 04:12AM UTC by timmywil comment:12

Duplicate of #7128.