Opened 2 years ago

Last modified 2 months ago

#14275 assigned defect

dojo.safeMixin can fail in IE

Reported by: dhaber Owned by: elazutkin
Priority: high Milestone: tbd
Component: Core Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:

Description

This applies to dojo 1.4 through 1.6 and IE 6, 7 & 8.

If you declare a new class that has a constructor which uses dojo.safeMixin but you pass no parameters to the constructor it will fail in IE. For example:

dojo.declare("a.b.c", null, {
	
	constructor: function(args) {
		dojo.safeMixin(this, args);
	}});

The above will fail in IE if you do this:

var d = new a.b.c();

Change History (6)

comment:1 Changed 2 years ago by bill

Seems like this ticket is invalid. You are calling

dojo.safeMixin({}, undefined)

whereas the API documentation says that you have to pass in an object as the second argument.

comment:2 Changed 2 years ago by dante

Techincally invalid by API docs. dojo.mixin({}, undefined) works fine. Ironic the mixin() with the word "safe" in it doesn't check presence like the seemingly "unsafe" mixin() (and private _mixin() functions) attached to the dojo object.

comment:3 Changed 2 years ago by bill

  • Milestone set to tbd

comment:4 Changed 2 years ago by acabler

I would really like to see a fix for this. This one just cost me a day and is very difficult to debug, but very easy to fix. If nothing else, it would be nice to have the behavior match across the browsers. Especially since IE bugs are much harder to debug.

comment:5 Changed 2 years ago by bill

  • Component changed from General to Core
  • Owner set to elazutkin
  • Status changed from new to assigned

Giving to Eugene since safeMixin() is defined in declare.js.

comment:6 Changed 2 months ago by soleimani

a simple workaround is always pass {} to declare function

    var jr = new JsonRest(); // cause exception
    var jr = new JsonRest({}); // it works
Note: See TracTickets for help on using tickets.