#10581 closed bug (wontfix)
JQuery change String.prototype.split in IE < 9 (add trim)
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | core | Version: | 1.7b2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
In IE 6, 7, 8: (' a ').split(/\s+/).length == 1 but should be 3.
Change History (8)
comment:1 Changed 11 years ago by
comment:2 follow-up: 3 Changed 11 years ago by
Component: | unfiled → misc |
---|---|
Priority: | undecided → low |
Resolution: | → wontfix |
Status: | new → closed |
jQuery does not modify native objects.
comment:3 Changed 11 years ago by
Replying to rwaldron:
jQuery does not modify native objects.
Yes, jQuery should not modify the native objects, and in its code, it does not, but in fact changes occur, it is easily and consistently reproduced (just try it). I don't know how it happens, but it is a serious bug that prevents work. Of course, part of the blame lies with IE.
comment:4 Changed 11 years ago by
Component: | misc → core |
---|---|
Priority: | low → high |
Resolution: | wontfix |
Status: | closed → reopened |
Your subject...
JQUERY CHANGE STRING.PROTOTYPE.SPLIT
implies that jQuery has changed something.
comment:5 follow-up: 6 Changed 11 years ago by
Owner: | set to [email protected]… |
---|---|
Priority: | high → low |
Status: | reopened → pending |
I'm still not sure where the jQuery bug is...? I just tested this: http://jsfiddle.net/rwaldron/4k9aw/show/light/ in IE98 and the result for jQuery.trim() was as expected.
comment:6 Changed 11 years ago by
Replying to rwaldron:
I'm still not sure where the jQuery bug is...? I just tested this: http://jsfiddle.net/rwaldron/4k9aw/show/light/ in IE98 and the result for jQuery.trim() was as expected.
Try this in IE8, in any site with jQuery (in IE9 all correct):
'xAx'.split(/x/).length
You should now have 3, but it turns 1, as if somewhere inside the trim is applied for 'xAx' before split. Maybe the reason is that in the IE < 9 function trim not native.
comment:7 follow-up: 8 Changed 11 years ago by
Resolution: | → wontfix |
---|---|
Status: | pending → closed |
So, where is the bug in jQuery? String.prototype.split is not jQuery's domain...
I recommend using Underscore: http://documentcloud.github.com/underscore/ for compatible utility methods.
comment:8 Changed 11 years ago by
Replying to rwaldron:
So, where is the bug in jQuery? String.prototype.split is not jQuery's domain...
I recommend using Underscore: http://documentcloud.github.com/underscore/ for compatible utility methods.
You're right, and I was wrong: it seems to be a bug of IE and it does not depend on jQuery. Sorry for your trouble.
Not only for spaces: 'xAx'.split(/x/).length == 1 but should be 3.