Skip to content

jQuery.merge: add note about it correcting the length property #686

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

Closed
arthurvr opened this issue Mar 28, 2015 · 6 comments
Closed

jQuery.merge: add note about it correcting the length property #686

arthurvr opened this issue Mar 28, 2015 · 6 comments
Assignees

Comments

@arthurvr
Copy link
Member

Internally we use jQuery.merge to merge jQuery objects which are array-like so they need to have length corrected. I see it's not documented at http://api.jquery.com/jQuery.merge/ so perhaps an API ticket is needed (cc @arthurvr)

jquery/jquery#2155

@mgol
Copy link
Member

mgol commented Apr 7, 2015

This is documenting currently undocumented behavior so I'd like @jquery/core to approve it first.

@markelog
Copy link
Member

markelog commented Apr 7, 2015

We say that merge excepts arrays not array-likes, therefore we would need to get funky of explaining why jquery corrects the length.

Do we need to document that? Essentially, we would be documenting array-likes as acceptable arguments, if user uses merge correctly, their wouldn't even know about that side-effect.

@mgol
Copy link
Member

mgol commented Apr 7, 2015

Do we need to document that? Essentially, we would be documenting array-likes as acceptable arguments, if user uses merge correctly, their wouldn't even know about that side-effect.

The problem is jQuery.merge is public and de facto accepts array-likes; people use it to e.g. merge with the arguments object. So we might as well document this behavior, I doubt it'll ever change.

@timmywil
Copy link
Member

timmywil commented Apr 7, 2015

we might as well document this behavior, I doubt it'll ever change.

Agreed. However, although we use this term in several places already, I think we should document what exactly "Array-like" means, perhaps on the types page.

@mgol
Copy link
Member

mgol commented Apr 7, 2015

@timmywil Good idea.

@arthurvr
Copy link
Member Author

Once the Array-like type lands to the types page I can update this PR. Thanks for the suggestions you all!

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

Successfully merging a pull request may close this issue.

4 participants