#5930 closed bug (duplicate)
$('[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
Change History (12)
comment:1 Changed 13 years ago by
Milestone: | 1.5 → 1.4.2 |
---|---|
Version: | 1.4 → 1.4.1 |
comment:2 Changed 13 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:3 Changed 13 years ago by
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
Didn't mean to close this, it's still something we want to tackle.
comment:5 Changed 12 years ago by
Milestone: | 1.4.2 → 1.5 |
---|
comment:7 Changed 12 years ago by
Keywords: | queryselectorall sizzle attribute boolean added; Sizzle removed |
---|---|
Priority: | major → blocker |
Status: | reopened → open |
Version: | 1.4.1 → 1.4.4 |
comment:8 Changed 12 years ago by
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.
comment:9 Changed 12 years ago by
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
comment:10 Changed 12 years ago by
Milestone: | 1.5 → 1.6 |
---|
This is getting moved to 1.6 for when the $.attr happens.
comment:11 Changed 12 years ago by
Resolution: | → duplicate |
---|---|
Status: | open → closed |
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.