Move ol.Object.createFromObject to its proper home as a simplified API function
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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'));
|
||||
|
||||
Reference in New Issue
Block a user