Skip to content

Commit

Permalink
Make sure lang.getObject() returns 3rd arg if 1st arg is empty, fixes…
Browse files Browse the repository at this point in the history
… #18542.
  • Loading branch information
asudoh committed Mar 31, 2015
1 parent 0c4df7a commit 9076a95
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion _base/lang.js
Expand Up @@ -216,7 +216,7 @@ define(["./kernel", "../has", "../sniff"], function(dojo, has){
// context: Object?
// Optional. Object to use as root of path. Defaults to
// 'dojo.global'. Null may be passed.
return getProp(name ? name.split(".") : [], create, context); // Object
return !name ? context : getProp(name.split("."), create, context); // Object
},

exists: function(name, obj){
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/_base/lang.js
Expand Up @@ -51,7 +51,8 @@ define([

// empty path should return the same object
assert.strictEqual(lang.getObject('', false, test), test);
assert.strictEqual(lang.getObject(''), kernel.global);
assert.strictEqual(lang.getObject('', false, null), null);
assert.strictEqual(lang.getObject(''), undefined);
},

'.setObject': function () {
Expand Down

0 comments on commit 9076a95

Please sign in to comment.