Bug Tracker

Ticket #5930 (closed bug: duplicate)

Opened 5 years ago

Last modified 3 years ago

$('[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:
Blocking: Blocked by:

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

comment:1 Changed 5 years ago by john

  • Version changed from 1.4 to 1.4.1
  • Milestone changed from 1.5 to 1.4.2

comment:2 Changed 4 years ago by john

  • Status changed from new to closed
  • Resolution set to wontfix

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.

comment:3 Changed 4 years ago by john

  • Status changed from closed to reopened
  • Resolution wontfix deleted

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

comment:4 Changed 4 years ago by dmethvin

#5066 is a duplicate of this ticket.

comment:5 Changed 4 years ago by jitter

  • Milestone changed from 1.4.2 to 1.5

comment:6 Changed 4 years ago by snover

#5918 is a duplicate of this ticket.

comment:7 Changed 4 years ago by snover

  • Keywords ie8 queryselectorall qsa sizzle attribute boolean added; ie8, qsa, Sizzle removed
  • Priority changed from major to blocker
  • Version changed from 1.4.1 to 1.4.4
  • Status changed from reopened to open

comment:8 Changed 4 years ago by me@…

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 4 years ago by anonymous

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 4 years ago by john

  • Milestone changed from 1.5 to 1.6

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

comment:11 Changed 3 years ago by timmywil

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

comment:12 Changed 3 years ago by timmywil

Duplicate of #7128.

Note: See TracTickets for help on using tickets.