Bug Tracker

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#14767 closed bug (notabug)

isArray returns false for the new typed arrays

Reported by: dh@… 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.

Change History (2)

comment:1 Changed 5 years ago by dmethvin

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

comment:2 Changed 5 years ago by axl.jq

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

Note: See TracTickets for help on using tickets.