Skip to content

ResizeSensor doesn't - actually - support native collections #21

Closed
@phloe

Description

@phloe

From Line 131 of ResizeSensor.js:

        if ('array' === typeof element

Firstly - native element collections are not Arrays - but NodeLists or HTMLCollections.
Secondly - typeof doesn't return 'array' - even for arrays; it returns 'object' - sadly. And same goes for NodeLists and HTMLCollections...

... which all means that that line of code doesn't actually do anything ;)

Something like the following should work:

        var elementString = element.toString();
        if (elementString === "[object NodeList]" || elementString === "[object HTMLCollection]"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions