Opened 8 years ago

Closed 6 years ago

#17684 closed defect (invalid)

lang.mixin dest falsey returns null

Reported by: dave.wilton Owned by:
Priority: undecided Milestone: 1.11
Component: Core Version: 1.9.2
Keywords: Cc:
Blocked By: Blocking:


It says in the documentation "If dest is falsy, then a new object is manufactured before copying/adding properties begins."

So I beleive this should return a result, however it returns null in chrome 31 and firefox 26:

require(dojo/_base/lang?, function(lang){

var a = null; falsey dest lang.mixin(a, { d: "f", g: "h" }); console.log(a); result should be d: f, g: h


It returns null if either the source or the dest is null.

I have tried various falsey values (NaN, false, "", undefined) and it appears that it returns the input falsey value

JS fiddle:

Change History (2)

comment:1 Changed 8 years ago by freddefisk

This works as expected. It's not possible to change which object a variable is referring from within another function in javascript, that would be weird.

What mixin does when dest is falsy is to create a new object and return it. See this modified example:

Also check out the source code:

Last edited 8 years ago by freddefisk (previous) (diff)

comment:2 Changed 6 years ago by dylan

Milestone: tbd1.11
Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.