Skip to main content

Bug Tracker

Side navigation

#9423 closed bug (invalid)

Opened May 25, 2011 06:40PM UTC

Closed May 25, 2011 06:52PM UTC

Last modified June 03, 2011 03:43PM UTC

Attribute selectors need to be prefixed with a tag in Internet Explorer 8 and Seamonkey

Reported by: donny Owned by:
Priority: low Milestone:
Component: selector Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:

I have code that uses an attribute selector by calling the "filter" method, eg:

var link = $('a').filter('[href^=http://www.example]'); //doesn't work

However I've found that this fails in Internet Explorer 8.0.7600.16385 on Windows 7 and Seamonkey 2.0.11, Seamonkey 2.0.14 (both on Ubuntu 10.04)

It works when the selector is prefixed with the tag, eg:

var link = $('a').filter('a[href^=http://www.example]'); //works

or when I reference it by id, eg:

var link = $('a').filter('#link[href^=http://www.example]'); //works

and I presume with any other selector before it.

The error in internet explorer is (in 1.6.1 in the minified version):

Exception thrown and not caught, line 17, char 11966.

In the un-minified version of 1.6.1, line 4025, char 2.

The error in seamonkey is:

Error: uncaught exception: Syntax error, unrecognized expression: [href^=http://www.example]

This fails with jQuery 1.5, 1.6, and 1.6.1 but works with 1.2, 1.3, and 1.4.

Here are the jsfiddle test cases: (expected output is "First: 1, Second: 1". Actual output is "First: 1, Second: ...")

Fails with 1.6.1:

Fails with 1.5:

Works with 1.4:

Works with 1.3:

Works with 1.2:

This fails for all attribute selectors I've tried that aren't prefixed with a tag, eg

"[href=http://www.example]", etc.
Attachments (0)
Change History (2)

Changed May 25, 2011 06:52PM UTC by rwaldron comment:1

component: unfiledselector
priority: undecidedlow
resolution: → invalid
status: newclosed

Attribute selectors requre quotes around the attribute value

Changed June 03, 2011 03:43PM UTC by anonymous comment:2

I had this one when I was using letter different than latin for fancybox rel attribute.