Move ol.Object.createFromObject to its proper home as a simplified API function

This commit is contained in:
Tom Payne
2012-08-16 21:43:23 +02:00
parent 69cd2df009
commit a30b2f1795
4 changed files with 43 additions and 30 deletions
-15
View File
@@ -67,21 +67,6 @@ ol.Object.capitalize = function(str) {
};
/**
* @param {ol.Object|Object} arg Argument.
* @return {ol.Object} Object.
*/
ol.Object.create = function(arg) {
if (arg instanceof ol.Object) {
return arg;
} else {
var object = new ol.Object();
object.setOptions(arg);
return object;
}
};
/**
* @param {ol.Object} obj Object.
* @return {Object.<string, {target: ol.Object, key: string}>} Accessors.
-15
View File
@@ -367,21 +367,6 @@ function testBindSelf() {
}
function testCreateFromObject() {
var obj = {k: 1};
obj = ol.Object.create(obj);
assertTrue(obj instanceof ol.Object);
assertEquals(1, obj.get('k'));
}
function testCreateFromObject() {
var obj1 = new ol.Object();
var obj2 = ol.Object.create(obj1);
assertTrue(obj2 === obj1);
}
function testCreateWithOptions() {
var obj = new ol.Object({k: 1});
assertEquals(1, obj.get('k'));