#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: |
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
Change History (5)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
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.
comment:3 Changed 12 years ago by
Component: | unfiled → event |
---|---|
Milestone: | None → 1.7.2 |
Owner: | set to dmethvin |
Priority: | undecided → low |
Status: | new → assigned |
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
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
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
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.
Using git bisect, tracked this down to https://github.com/jquery/jquery/commit/a7e911b7fe84a35234d4be18102e168c6644e40d