Bug Tracker

Modify

Ticket #11829 (closed bug: worksforme)

Opened 12 months ago

Last modified 12 months ago

isArray bug IE6 and IE7

Reported by: les.szklanny@… Owned by: rwaldron
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocking: Blocked by:

Description

I'd like to point out an obscure IE6 and IE7 bug in the isArray function.

The call below will display [object Object], not [object Array], so the Ext.isArray() call will fail in this case.

if (window.opener) {

var test = Object.prototype.toString.call(window.opener.testArr); alert(test);

}

See a discussion here, search for 'Richard Cornford explains'

 http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/

Also, I'd consider delegating isArray to Array.isArrary where possible, see the ECMAScript 5.1 spec

 http://ecma-international.org/ecma-262/5.1/

Les

Change History

comment:1 Changed 12 months ago by anonymous

Ext.isArray ---> jQuery.isArray

comment:2 Changed 12 months ago by rwaldron

  • Owner set to rwaldron
  • Status changed from new to assigned

comment:3 Changed 12 months ago by rwaldron

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

Thanks for contribution, as it turns out, everything you've asked jQuery to do - it already does.

	isArray: Array.isArray || function( obj ) {
		return jQuery.type(obj) === "array";
	},


...


	type: function( obj ) {
		return obj == null ?
			String( obj ) :
			class2type[ toString.call(obj) ] || "object";
	},

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.