Ticket #9423 (closed bug: invalid)
Attribute selectors need to be prefixed with a tag in Internet Explorer 8 and Seamonkey
|Reported by:||donny||Owned by:|
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: http://jsfiddle.net/EyFRr/
Fails with 1.5: http://jsfiddle.net/KLh9s/
Works with 1.4: http://jsfiddle.net/5UDDb/
Works with 1.3: http://jsfiddle.net/mHUxs/
Works with 1.2: http://jsfiddle.net/kWqqw/
This fails for all attribute selectors I've tried that aren't prefixed with a tag, eg
"[href^=http://www.example]" "[href=http://www.example]", etc.