Opened 11 years ago

Closed 11 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 Eugene Lazutkin)

The example will make it clear

dojo.declare('ani', null, {
    constructor: function(param){
        this.c = param.attr;

var nomind = new ani('anirban');

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 Eugene Lazutkin

Description: modified (diff)
Owner: changed from anonymous to Eugene Lazutkin
Status: newassigned

It cannot be fixed. In general dojo.clone() works only on primitive types and naked objects. To clone proper objects made with dojo.clone() you should provide a cloning constructor, or (most probably) a special method, which does exactly that --- creates a clone of itself.

comment:2 Changed 11 years ago by bill

Since "it cannot be fixed" shouldn't you close this ticket as wontfix?

comment:3 Changed 11 years ago by Eugene Lazutkin

Resolution: wontfix
Status: assignedclosed
Note: See TracTickets for help on using tickets.