Opened 9 years ago
Closed 9 years ago
#15246 closed bug (notabug)
$.extend with deep copy of an array property merges the array instead of replacing it
Reported by: | i23098 | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.11.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Change History (2)
comment:1 Changed 9 years ago by
comment:2 Changed 9 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
Merging objects and arrays rather than overwriting them is the behavior that differentiates our deep extend from our shallow extend.
http://api.jquery.com/jQuery.extend/:
On a
deep
extend, Object and Array are extended, but object wrappers on primitive types such as String, Boolean, and Number are not. Deep-extending a cyclical data structure will result in an error.For needs that fall outside of this behavior, write a custom extend method instead, or use a library like lodash.
Note: See
TracTickets for help on using
tickets.
It also happens in 2.x