git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
$.extend deep now copies children's children, ect...
[jquery.git]
/
build
/
js
/
base2.js
diff --git
a/build/js/base2.js
b/build/js/base2.js
index
ee57e5d
..
87eb37b
100644
(file)
--- a/
build/js/base2.js
+++ b/
build/js/base2.js
@@
-1,4
+1,4
@@
-// timestamp: Tue, 24 Apr 2007 09:57:15
\r
+// timestamp: Tue, 01 May 2007 19:13:00
\r
/*
\r
base2.js - copyright 2007, Dean Edwards
\r
http://www.opensource.org/licenses/mit-license
\r
/*
\r
base2.js - copyright 2007, Dean Edwards
\r
http://www.opensource.org/licenses/mit-license
\r
@@
-141,6
+141,12
@@
var assertType = function(object, type, message) {
}
\r
};
\r
\r
}
\r
};
\r
\r
+var copy = function(object) {
\r
+ var fn = new Function;
\r
+ fn.prototype = object;
\r
+ return new fn;
\r
+};
\r
+
\r
var format = function(string) {
\r
// replace %n with arguments[n]
\r
// e.g. format("%1 %2%3 %2a %1%3", "she", "se", "lls");
\r
var format = function(string) {
\r
// replace %n with arguments[n]
\r
// e.g. format("%1 %2%3 %2a %1%3", "she", "se", "lls");
\r
@@
-416,12
+422,12
@@
var Enumerable = Module.extend({
},
\r
\r
filter: function(object, test, context) {
\r
},
\r
\r
filter: function(object, test, context) {
\r
- return this.reduce(object, new Array2, function(result, value, key) {
\r
+ return this.reduce(object, function(result, value, key) {
\r
if (test.call(context, value, key, object)) {
\r
result[result.length] = value;
\r
}
\r
return result;
\r
if (test.call(context, value, key, object)) {
\r
result[result.length] = value;
\r
}
\r
return result;
\r
- });
\r
+ }, new Array2);
\r
},
\r
\r
invoke: function(object, method) {
\r
},
\r
\r
invoke: function(object, method) {
\r
@@
-448,7
+454,7
@@
var Enumerable = Module.extend({
});
\r
},
\r
\r
});
\r
},
\r
\r
- reduce: function(object, result, block, context) {
\r
+ reduce: function(object, block, result, context) {
\r
this.forEach (object, function(value, key) {
\r
result = block.call(context, result, value, key, object);
\r
});
\r
this.forEach (object, function(value, key) {
\r
result = block.call(context, result, value, key, object);
\r
});
\r
@@
-475,10
+481,10
@@
var IArray = Module.extend({
combine: function(keys, values) {
\r
// combine two arrays to make a hash
\r
if (!values) values = keys;
\r
combine: function(keys, values) {
\r
// combine two arrays to make a hash
\r
if (!values) values = keys;
\r
- return this.reduce(keys, {}, function(object, key, index) {
\r
+ return this.reduce(keys, function(object, key, index) {
\r
object[key] = values[index];
\r
return object;
\r
object[key] = values[index];
\r
return object;
\r
- });
\r
+ }, {});
\r
},
\r
\r
copy: function(array) {
\r
},
\r
\r
copy: function(array) {
\r
@@
-904,20
+910,20
@@
var Namespace = Base.extend({
\r
var namespace = "var base=" + base + ";";
\r
var imports = ("base2,lang," + this.imports).split(",");
\r
\r
var namespace = "var base=" + base + ";";
\r
var imports = ("base2,lang," + this.imports).split(",");
\r
- _private.imports = Enumerable.reduce(imports, namespace, function(namespace, name) {
\r
+ _private.imports = Enumerable.reduce(imports, function(namespace, name) {
\r
if (base2[name]) namespace += base2[name].namespace;
\r
return namespace;
\r
if (base2[name]) namespace += base2[name].namespace;
\r
return namespace;
\r
- });
\r
+ }, namespace);
\r
\r
var namespace = format("base2.%1=%1;", this.name);
\r
var exports = this.exports.split(",");
\r
\r
var namespace = format("base2.%1=%1;", this.name);
\r
var exports = this.exports.split(",");
\r
- _private.exports = Enumerable.reduce(exports, namespace, function(namespace, name) {
\r
+ _private.exports = Enumerable.reduce(exports, function(namespace, name) {
\r
if (name) {
\r
this.namespace += format("var %2=%1.%2;", this.name, name);
\r
namespace += format("if(!%1.%2)%1.%2=%2;base2.%2=%1.%2;", this.name, name);
\r
}
\r
return namespace;
\r
if (name) {
\r
this.namespace += format("var %2=%1.%2;", this.name, name);
\r
namespace += format("if(!%1.%2)%1.%2=%2;base2.%2=%1.%2;", this.name, name);
\r
}
\r
return namespace;
\r
- }, this);
\r
+ }, namespace, this);
\r
\r
if (this.name != "base2") {
\r
base2.namespace += format("var %1=base2.%1;", this.name);
\r
\r
if (this.name != "base2") {
\r
base2.namespace += format("var %1=base2.%1;", this.name);
\r
@@
-949,7
+955,7
@@
eval(this.exports);
var lang = new Namespace(this, {
\r
name: "lang",
\r
version: base2.version,
\r
var lang = new Namespace(this, {
\r
name: "lang",
\r
version: base2.version,
\r
- exports: "K,assert,assertType,assignID,instanceOf,extend,format,forEach,match,rescape,slice,trim",
\r
+ exports: "K,assert,assertType,assignID,copy,instanceOf,extend,format,forEach,match,rescape,slice,trim",
\r
\r
init: function() {
\r
this.extend = extend;
\r
\r
init: function() {
\r
this.extend = extend;
\r