Skip to main content

Bug Tracker

Side navigation

#14767 closed bug (notabug)

Opened February 06, 2014 09:53PM UTC

Closed February 06, 2014 09:58PM UTC

Last modified February 09, 2014 08:04PM UTC

isArray returns false for the new typed arrays

Reported by: dh@madisonsolutions.co.uk Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 2.1.0
Keywords: Cc:
Blocked by: Blocking:
Description

I would expect $.isArray to return true for the new typed array objects - eg Float32Array and Int16Array, etc. In actual fact, all return false:

$.isArray(new Array(1));

true

$.isArray(new Float32Array(1));

false

$.isArray(new Float64Array(1));

false

$.isArray(new Int8Array(1));

false

$.isArray(new Int16Array(1));

false

$.isArray(new Int32Array(1));

false

However, it might be deliberate behaviour to return false, because typed arrays don't support all the same functions as standard arrays - eg push, pop, map etc. If so, this behaviour should be documented.

Attachments (0)
Change History (2)

Changed February 06, 2014 09:58PM UTC by dmethvin comment:1

resolution: → notabug
status: newclosed

This is definitely a docs issue, isArray is primarily for our internal needs and we have no need/desire to consume any of those arrayish types. Please open a ticket in the docs repo, as described in the page you passed through: http://bugs.jquery.com

Changed February 09, 2014 08:04PM UTC by axl.jq comment:2

I suggest not changing this, if those new types doesn't implement all expected properties/methods from Array