Bug Tracker

Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#10961 closed bug (fixed)

Error in XRegExp using jQuery 1.7.1 in IE6-9

Reported by: rworth Owned by: dmethvin
Priority: low Milestone: 1.7.2
Component: event Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:


When upgrading to the latest jQuery, 1.7.1, I found a regression when using the popular XRegExp library (a dependency of the popular SyntaxHighlighter). The error occurs in all versions of IE. Wasn't able to get it running on jsFiddle, but here's the minimal test case:

<script src=http://code.jquery.com/jquery-1.7.1.js></script>
<script src=http://xregexp.com/xregexp.js></script>
jQuery(window).bind("click", function() {});

And the error:

Unable to get value of the property 'slice': object is null or undefined (line 281) (xregexp.js)

Even though the error is showing up on a line number in xregexp, that library is stable since March 2010, and works with all previous stable versions of jQuery (1.0.4, 1.1.4, 1.2.6, 1.3.2, 1.4.4, 1.5.2, 1.6.4, 1.7.0), so this is a regression in jQuery 1.7.1

Change History (5)

comment:2 Changed 12 years ago by sindresorhus

XRegExp is naughty and overrides the RegExp.prototype.exec which jQuery uses 26 times.

I don't think jQuery should fix incompatibilities with libraries that modifies the built-in prototypes.


comment:3 Changed 12 years ago by dmethvin

Component: unfiledevent
Milestone: None1.7.2
Owner: set to dmethvin
Priority: undecidedlow
Status: newassigned

I see what's happening though, their shimmed .exec() doesn't like being passed undefined but the native ones are fine with it. It's an easy fix so we might as well.

comment:4 Changed 11 years ago by Dave Methvin

Resolution: fixed
Status: assignedclosed

Fix #10961. XRegExp's shimmed .exec() can't handle undefined.

There's no reason to call quickParse if selector is falsy, so it's a minor performance optimization anyway. No change in behavior at all on our side, so no test case needed.

Changeset: 5798eab1240734e5d04a85acd628d007f4c93765

comment:5 Changed 11 years ago by Steven Levithan

As the author of XRegExp, I agree with sindresorhus that this is not jQuery's problem. For the record, the bug is squashed in XRegExp 1.5.1.

Note: See TracTickets for help on using tickets.