Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spread operator breaks on HTML Collection or NodeList with tslib@2.3.0 #153

Closed
utsavchatterjee opened this issue Jul 19, 2021 · 1 comment · Fixed by #155
Closed

Spread operator breaks on HTML Collection or NodeList with tslib@2.3.0 #153

utsavchatterjee opened this issue Jul 19, 2021 · 1 comment · Fixed by #155

Comments

@utsavchatterjee
Copy link

Let htmlCollection be an HTMLCollection {} such that,

Object.keys(htmlCollection) is [‘0’, ‘1’, ‘2’]

Object.values(htmlCollection) is [ HTMLDivElement {}, HTMLDivElement {}, HTMLDivElement {} ]

Using tslib <= 2.2.0

[ …htmlCollection ] gives [ HTMLDivElement {}, HTMLDivElement {}, HTMLDivElement {} ]

Using tslib 2.3.0

[ …htmlCollection ] gives [ HTMLCollection {} ], where HTMLCollection {} is the same as htmlCollection

Similar behaviour is observed for NodeList {}.

@rbuckton
Copy link
Member

rbuckton commented Aug 9, 2021

Apparently NodeList and HTMLCollection do not have [Symbol.isConcatSpreadable]: true, so the array concat adds them as an element instead of adding their elements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants