Opened 11 years ago
Closed 10 years ago
#11756 closed defect (wontfix)
dojo.clone: Error on cloning objects whose constructor require an object
Reported by: | Anirban Mitra | Owned by: | Eugene Lazutkin |
---|---|---|---|
Priority: | high | Milestone: | tbd |
Component: | Core | Version: | 1.5 |
Keywords: | dojo.clone | Cc: | |
Blocked By: | Blocking: |
Description (last modified by )
The example will make it clear
dojo.declare('ani', null, { constructor: function(param){ this.c = param.attr; } }); var nomind = new ani('anirban'); dojo.clone(nomind);
throws out error TypeError: Result of expression 'param' [undefined] is not an object
.
Don't know if the bug can possibly be fixed but at least a more meaningful error can be thrown.
Change History (3)
comment:1 Changed 11 years ago by
Description: | modified (diff) |
---|---|
Owner: | changed from anonymous to Eugene Lazutkin |
Status: | new → assigned |
comment:2 Changed 11 years ago by
Since "it cannot be fixed" shouldn't you close this ticket as wontfix?
comment:3 Changed 10 years ago by
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
Note: See
TracTickets for help on using
tickets.
It cannot be fixed. In general
dojo.clone()
works only on primitive types and naked objects. To clone proper objects made withdojo.clone()
you should provide a cloning constructor, or (most probably) a special method, which does exactly that --- creates a clone of itself.