Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#10581 closed bug (wontfix)

JQuery change String.prototype.split in IE < 9 (add trim)

Reported by: vohhov@… Owned by: vohhov@…
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 7 years ago by vohhov@…

Not only for spaces: 'xAx'.split(/x/).length == 1 but should be 3.

comment:2 Changed 7 years ago by Rick Waldron

Component: unfiledmisc
Priority: undecidedlow
Resolution: wontfix
Status: newclosed

jQuery does not modify native objects.

comment:3 in reply to:  2 Changed 7 years ago by anonymous

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 7 years ago by Rick Waldron

Component: misccore
Priority: lowhigh
Resolution: wontfix
Status: closedreopened

Your subject...

JQUERY CHANGE STRING.PROTOTYPE.SPLIT

implies that jQuery has changed something.

comment:5 Changed 7 years ago by Rick Waldron

Owner: set to vohhov@…
Priority: highlow
Status: reopenedpending

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 in reply to:  5 Changed 7 years ago by anonymous

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 Changed 7 years ago by Rick Waldron

Resolution: wontfix
Status: pendingclosed

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 in reply to:  7 Changed 7 years ago by anonymous

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.

Note: See TracTickets for help on using tickets.