Skip to content

Type checking support for Array Iterator #3553

@danahartweg

Description

@danahartweg

Description

When using Babel, specifically with array polyfills for iterator support, all array prototypes are modified for that support. Therefore, toString.call(obj) reports as [object Array Iterator] instead of simply [object Array], which jQuery has no awareness of in the class2type map. The goal would be to update the class2type map for that support so these arrays report themselves as arrays instead of objects.

I know there has been some contention with this type checking in the past, specifically around the Error object, so I decided to open an issue for discussion before submitting a PR with the changes proposed below.

Proposed changes

Not sure the best way to provide a test case for this. Instead, this is the code change I had in mind.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions