Bug Tracker

Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#6125 closed bug (wontfix)

Unfiltered for loop breaks animation in IE when a script extends the Object prototype

Reported by: willmorgan Owned by:
Priority: undecided Milestone: 1.4.2
Component: effects Version: 1.4.1
Keywords: Cc:
Blocked by: Blocking:


I've added a function called size() to the Object prototype for getting the size of objects.

I noticed this broke animation in general, so commented out each module of my code until I found the source of the problem, which was the above.

I've got a fix, which is simply filtering the for loop on line 2724 where Sizzle.filter is defined:

if ( Expr.filter.hasOwnProperty( type ) ) {

As expected this doesn't cause a problem in Firefox ;)

Change History (6)

comment:1 follow-up: Changed 5 years ago by snover

  • Priority set to undecided
  • Resolution set to wontfix
  • Status changed from new to closed

Modifying Object.prototype is verboten.

comment:2 in reply to: ↑ 1 Changed 5 years ago by willmorgan

Replying to snover:

Modifying Object.prototype is verboten.

Why? Is that not how the entire idea of inheritance works in JavaScript?

comment:3 Changed 5 years ago by ajpiano

No, it is not. It is fine to work with prototypes of various objects, but it is considered very poor practise to modify Object.protoype.


comment:4 Changed 5 years ago by willmorgan

Surely bulletproofing jQuery's code is a good idea, regardless of whether this is considered bad practice or not.

comment:5 Changed 5 years ago by ajpiano

This has come up before: #1529, #2721, #3785, #4121, #6132

Consistently jQuery's position has been, as Dave stated in #3785, that "Rewriting every for/in loop and object membership test is just too expensive." Until such time that the position should happen to change on that matter, jQuery will not work in pages that have modifications to Object.prototype.

Last edited 5 years ago by ajpiano (previous) (diff)

comment:6 Changed 5 years ago by willmorgan

I would agree that consistency is probably the best thing, though in fact, I've seen a few posts from John and Scott in the past saying that bulletproofing jQuery might be on the cards for future releases.

My £0.02 is that a widely used framework should be as portable and bulletproof as possible, and that there are arguments against extending the Object prototype and also not filtering for loops.. I've not seen any too much in depth discussion regarding the issue specific to jQuery, but if that's what the core team goes with, then fair enough.

Thanks for your time - I can imagine it's quite frustrating having closed many duplicates in the past hence the initial terseness (albeit 9 months later...)

Version 1, edited 5 years ago by willmorgan (previous) (next) (diff)
Note: See TracTickets for help on using tickets.