Opened 13 years ago

Closed 13 years ago

#388 closed defect (fixed)

dojo.lang.isArrayLike() fails on undefined and null

Reported by: anonymous Owned by: anonymous
Priority: high Milestone:
Component: General Version: 0.2
Keywords: Cc:
Blocked By: Blocking:

Description

below will prevent failure.

dojo.lang.isArrayLike = function(wh) {  
	return (dojo.lang.isArray(wh) ||   // null == undefined
               (!dojo.lang.isString(wh) && wh != null && dojo.lang.isNumberClean(wh.length)))
}
dojo.lang.isNumberClean(wh) {
        return (dojo.lang.isNumber(wh) && isFinite(wh)); // NaN is not finite
}

Change History (2)

comment:1 Changed 13 years ago by rfa@…

What is isArrayLike suppose to detecting, styleSheets and cssRules? If so then this fixes the failure and does styleSheets:

dojo.lang.isArrayLike = function(wh) { 
return x = (wh && isFinite(wh.length) && (wh instanceof Array || typeof(wh.item) == 'function'));
}

comment:2 Changed 13 years ago by Tom Trenka

Resolution: fixed
Status: newclosed

Looks like this was fixed a while ago.

Note: See TracTickets for help on using tickets.