Bug Tracker

Modify

Ticket #4733 (closed bug: worksforme)

Opened 4 years ago

Last modified 3 years ago

makeArray sometimes breaks on DOM Elements

Reported by: appden Owned by: flesler
Priority: major Milestone: 1.4
Component: core Version: 1.3.2
Keywords: Cc: appden
Blocking: Blocked by:

Description

This function queries for a 'length' property and then makes a false assumption that a DOM element's 'length' is undefined. This sometimes is a false assumption and can cause havoc.

In my case, a Firefox 3 memory bug sometimes caused an element to return a *gigantic* number as its length, causing an unresponsive script error when makeArray tried to loop through that huge number.

makeArray should have a more explicit test on its input.

Attachments

test-4733.html Download (429 bytes) - added by dmethvin 3 years ago.
$.makeArray(formelement)

Change History

comment:1 Changed 4 years ago by appden

BTW, my temporary fix was to overwrite the makeArray function and add a test to see if the input has a 'nodeType'. The Firefox 3 bug that I mentioned is filed here:

 https://bugzilla.mozilla.org/show_bug.cgi?id=496652

comment:2 Changed 4 years ago by flesler

  • Cc appden added
  • Owner set to flesler

Changed 3 years ago by dmethvin

$.makeArray(formelement)

comment:3 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to worksforme

Can you reopen this with a test case? It seems like DOM elements with a length should work properly. For example, $.makeArray(formelement) returns the form.elements collection as an Array. I've attached an example.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.