Skip to main content

Bug Tracker

Side navigation

#10961 closed bug (fixed)

Opened December 06, 2011 11:46AM UTC

Closed December 14, 2011 02:58AM UTC

Last modified March 09, 2012 07:37PM UTC

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:
Description

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>
<script>
jQuery(window).bind("click", function() {});
</script>

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

Attachments (0)
Change History (5)

Changed December 06, 2011 11:47AM UTC by rworth comment:1

Changed December 06, 2011 12:54PM UTC by sindresorhus comment:2

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.

-1.

Changed December 06, 2011 02:25PM UTC by dmethvin comment:3

component: unfiledevent
milestone: None1.7.2
owner: → 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.

Changed December 14, 2011 02:58AM UTC by Dave Methvin comment:4

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

Changed February 25, 2012 11:51PM UTC by Steven Levithan comment:5

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.