[Pkg-javascript-commits] [dojo] 54/149: Make sure lang.getObject() returns 3rd arg if 1st arg is empty, fixes #18542.

David Prévot taffit at moszumanska.debian.org
Sat Feb 27 03:13:47 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository dojo.

commit 9076a957cceac3f1411f9ec1abb4eb96822810b5
Author: Akira Sudoh <asudoh at gmail.com>
Date:   Tue Mar 31 23:08:48 2015 +0900

    Make sure lang.getObject() returns 3rd arg if 1st arg is empty, fixes #18542.
---
 _base/lang.js            | 2 +-
 tests/unit/_base/lang.js | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/_base/lang.js b/_base/lang.js
index e544eab..579450b 100644
--- a/_base/lang.js
+++ b/_base/lang.js
@@ -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){
diff --git a/tests/unit/_base/lang.js b/tests/unit/_base/lang.js
index 01da2aa..bc175ff 100644
--- a/tests/unit/_base/lang.js
+++ b/tests/unit/_base/lang.js
@@ -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 () {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git



More information about the Pkg-javascript-commits mailing list