Skip to main content

Bug Tracker

Side navigation

#6125 closed bug (wontfix)

Opened February 19, 2010 04:35PM UTC

Closed November 19, 2010 08:24AM UTC

Last modified December 01, 2010 05:20PM UTC

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

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 ;)

Attachments (2)
  • 6125.rar (42.5 KB) - added by willmorgan February 19, 2010 04:53PM UTC.

    Patched version of jQuery and test page that works correctly.

  • test.html (0.7 KB) - added by willmorgan February 19, 2010 04:35PM UTC.

    Test case document

Change History (6)

Changed November 19, 2010 08:24AM UTC by snover comment:1

priority: → undecided
resolution: → wontfix
status: newclosed

Modifying Object.prototype is verboten.

Changed December 01, 2010 11:42AM UTC by willmorgan comment:2

Replying to [comment:1 snover]:

Modifying Object.prototype is verboten.

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

Changed December 01, 2010 11:51AM UTC by ajpiano comment:3

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.

http://erik.eae.net/archives/2005/06/06/22.13.54/

Changed December 01, 2010 01:09PM UTC by willmorgan comment:4

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

Changed December 01, 2010 01:44PM UTC by ajpiano comment:5

_comment0: This has come up before \ \ http://bugs.jquery.com/ticket/6132 \ http://bugs.jquery.com/ticket/1529 \ http://bugs.jquery.com/ticket/4121 \ http://bugs.jquery.com/ticket/2721 \ http://bugs.jquery.com/ticket/3785 \ \ 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.1291211128856420

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.

Changed December 01, 2010 05:20PM UTC by willmorgan comment:6

_comment0: 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 plugin 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...)1291224050428146
_comment1: 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...)1291224072089105

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 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...)