diff --git a/src/zepto.js b/src/zepto.js index a7a558bde..29f462e43 100644 --- a/src/zepto.js +++ b/src/zepto.js @@ -64,7 +64,12 @@ var Zepto = (function() { } } - $.extend = function(target, source){ for (key in source) target[key] = source[key]; return target } + $.extend = function(target){ + slice.call(arguments, 1).forEach(function(source) { + for (key in source) target[key] = source[key]; + }) + return target; + } $.qsa = $$ = function(element, selector){ return slice.call(element.querySelectorAll(selector)) } function filtered(nodes, selector){ diff --git a/test/zepto.html b/test/zepto.html index 7ed714de3..bf99c225e 100644 --- a/test/zepto.html +++ b/test/zepto.html @@ -241,6 +241,10 @@

Zepto DOM unit tests

var obj = {}; t.assertIdentical(obj, $.extend(obj, {a: 1})); t.assertEqual(1, obj.a); + + obj = {}; + t.assertIdentical(obj, $.extend(obj, {a: 1}, {b: 2})) + t.assertEqual(2, obj.b); }, testDollar: function(t){