Bug Tracker

Modify

Ticket #9423 (closed bug: invalid)

Opened 2 years ago

Last modified 2 years ago

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

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

Description

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.

Change History

comment:1 Changed 2 years ago by rwaldron

  • Priority changed from undecided to low
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from unfiled to selector

Attribute selectors requre quotes around the attribute value

 http://jsfiddle.net/rwaldron/CLPzm/

comment:2 Changed 2 years ago by anonymous

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.