Opened 5 years ago

Closed 3 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:

Description

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

http://dojotoolkit.org/reference-guide/1.9/dojo/_base/lang.html#mixin

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: http://jsfiddle.net/6T3Te/

Change History (2)

comment:1 Changed 5 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: http://jsfiddle.net/6T3Te/1/

Also check out the source code: https://github.com/dojo/dojo/blob/1.9.2/_base/lang.js#L154

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

comment:2 Changed 3 years ago by dylan

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