Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#11139 closed bug (invalid)

Repeating identical selector results in error in IE7

Reported by: theallan Owned by: theallan
Priority: low Milestone: None
Component: selector Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

Description

It would appear that if you call an identical selector to the previous selector, IE7 will throw an error.

To reproduce simply open IE and the developer tools. Put the document into IE7 mode and then run:a

$('a')
$('a')

the second one will result in a Sizzle error being reported: "Syntax error, unrecognized expression: a"

Also tested with the current nightly ( f724bc6c921378b82d9d6fa17329b6451fbb7a51 ).

I know its generally not a good idea to repeat selectors like this, so this error could be seen as a good thing to encourage authors (like me...!) to reuse jQuery objects - however, throw an error (which itself is very misleading) in IE7 but not other browsers doesn't seem quite right.

Change History (3)

comment:1 Changed 8 years ago by ajpiano

Owner: set to theallan
Status: newpending

Thanks for taking the time to contribute to the jQuery project! I've made a simple test case (on the latest edge build) that when run in ie7 mode does not throw the error you described. http://jsfiddle.net/ajpiano/ZpjGb/show/ . If you can provide us with a test case that reproduces the error, please do so. Thanks.

comment:2 Changed 8 years ago by theallan

Status: pendingnew

I'm somewhat embarrassed about filing this against jQuery - it turns out it isn't a jQuery bug at all! I included a regexp library that overrides String.prototype.split and various other core methods, and there was a bug in that which was causing Sizzle to go haywire in IE7.

My apologies, but this bug should be closed as invalid!

comment:3 Changed 8 years ago by sindresorhus

Component: unfiledselector
Priority: undecidedlow
Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.