[Pkg-javascript-commits] [backbone] 93/211: Upgrading Backbone.js tests to Underscore 1.1.5

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 17:00:07 UTC 2014


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

js pushed a commit to tag 0.5.0
in repository backbone.

commit d97d8bf336186555b0562ee20c5880d7a24c8f79
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date:   Sun Mar 20 20:26:17 2011 -0400

    Upgrading Backbone.js tests to Underscore 1.1.5
---
 examples/todos/index.html                          |  2 +-
 index.html                                         |  2 +-
 test/test-zepto.html                               |  2 +-
 test/test.html                                     |  2 +-
 .../{underscore-1.1.4.js => underscore-1.1.5.js}   | 25 +++++++++++++++++-----
 5 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/examples/todos/index.html b/examples/todos/index.html
index 70d4919..d3ef3c4 100644
--- a/examples/todos/index.html
+++ b/examples/todos/index.html
@@ -6,7 +6,7 @@
     <link href="todos.css" media="all" rel="stylesheet" type="text/css"/>
     <script src="../../test/vendor/json2.js"></script>
     <script src="../../test/vendor/jquery-1.5.js"></script>
-    <script src="../../test/vendor/underscore-1.1.4.js"></script>
+    <script src="../../test/vendor/underscore-1.1.5.js"></script>
     <script src="../../backbone.js"></script>
     <script src="../backbone-localstorage.js"></script>
     <script src="todos.js"></script>
diff --git a/index.html b/index.html
index e571bbf..b5907b5 100644
--- a/index.html
+++ b/index.html
@@ -2255,7 +2255,7 @@ Inbox.messages.add(newMessage);
 
   </div>
 
-  <script src="test/vendor/underscore-1.1.4.js"></script>
+  <script src="test/vendor/underscore-1.1.5.js"></script>
   <script src="test/vendor/jquery-1.5.js"></script>
   <script src="test/vendor/json2.js"></script>
   <script src="backbone.js"></script>
diff --git a/test/test-zepto.html b/test/test-zepto.html
index 859a100..bcd39dc 100644
--- a/test/test-zepto.html
+++ b/test/test-zepto.html
@@ -7,7 +7,7 @@
   <script type="text/javascript" src="vendor/zepto-0.4.js"></script>
   <script type="text/javascript" src="vendor/qunit.js"></script>
   <script type="text/javascript" src="vendor/jslitmus.js"></script>
-  <script type="text/javascript" src="vendor/underscore-1.1.4.js"></script>
+  <script type="text/javascript" src="vendor/underscore-1.1.5.js"></script>
   <script type="text/javascript" src="../backbone.js"></script>
 
   <script type="text/javascript" src="events.js"></script>
diff --git a/test/test.html b/test/test.html
index e228086..d350ad2 100644
--- a/test/test.html
+++ b/test/test.html
@@ -7,7 +7,7 @@
   <script type="text/javascript" src="vendor/jquery-1.5.js"></script>
   <script type="text/javascript" src="vendor/qunit.js"></script>
   <script type="text/javascript" src="vendor/jslitmus.js"></script>
-  <script type="text/javascript" src="vendor/underscore-1.1.4.js"></script>
+  <script type="text/javascript" src="vendor/underscore-1.1.5.js"></script>
   <script type="text/javascript" src="../backbone.js"></script>
 
   <script type="text/javascript" src="events.js"></script>
diff --git a/test/vendor/underscore-1.1.4.js b/test/vendor/underscore-1.1.5.js
similarity index 96%
rename from test/vendor/underscore-1.1.4.js
rename to test/vendor/underscore-1.1.5.js
index 5aaaca3..c627740 100644
--- a/test/vendor/underscore-1.1.4.js
+++ b/test/vendor/underscore-1.1.5.js
@@ -1,4 +1,4 @@
-//     Underscore.js 1.1.4
+//     Underscore.js 1.1.5
 //     (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.
 //     Underscore is freely distributable under the MIT license.
 //     Portions of Underscore are inspired or borrowed from Prototype,
@@ -21,7 +21,7 @@
   var breaker = {};
 
   // Save bytes in the minified (but not gzipped) version:
-  var ArrayProto = Array.prototype, ObjProto = Object.prototype;
+  var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
 
   // Create quick reference variables for speed access to core prototypes.
   var slice            = ArrayProto.slice,
@@ -42,7 +42,8 @@
     nativeIndexOf      = ArrayProto.indexOf,
     nativeLastIndexOf  = ArrayProto.lastIndexOf,
     nativeIsArray      = Array.isArray,
-    nativeKeys         = Object.keys;
+    nativeKeys         = Object.keys,
+    nativeBind         = FuncProto.bind;
 
   // Create a safe reference to the Underscore object for use below.
   var _ = function(obj) { return new wrapper(obj); };
@@ -58,7 +59,7 @@
   }
 
   // Current version.
-  _.VERSION = '1.1.4';
+  _.VERSION = '1.1.5';
 
   // Collection Functions
   // --------------------
@@ -406,10 +407,12 @@
 
   // Create a function bound to a given object (assigning `this`, and arguments,
   // optionally). Binding with arguments is also known as `curry`.
+  // Delegates to **ECMAScript 5**'s native `Function.bind` if available.
   _.bind = function(func, obj) {
+    if (nativeBind && func.bind === nativeBind) return func.bind.apply(func, slice.call(arguments, 1));
     var args = slice.call(arguments, 2);
     return function() {
-      return func.apply(obj || {}, args.concat(slice.call(arguments)));
+      return func.apply(obj, args.concat(slice.call(arguments)));
     };
   };
 
@@ -472,6 +475,17 @@
     return limit(func, wait, true);
   };
 
+  // Returns a function that will be executed at most one time, no matter how
+  // often you call it. Useful for lazy initialization.
+  _.once = function(func) {
+    var ran = false, memo;
+    return function() {
+      if (ran) return memo;
+      ran = true;
+      return memo = func.apply(this, arguments);
+    };
+  };
+
   // Returns the first function passed as an argument to the second,
   // allowing you to adjust arguments, run code before and after, and
   // conditionally execute the original function.
@@ -501,6 +515,7 @@
   // Retrieve the names of an object's properties.
   // Delegates to **ECMAScript 5**'s native `Object.keys`
   _.keys = nativeKeys || function(obj) {
+    if (obj !== Object(obj)) throw new TypeError('Invalid object');
     var keys = [];
     for (var key in obj) if (hasOwnProperty.call(obj, key)) keys[keys.length] = key;
     return keys;

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



More information about the Pkg-javascript-commits mailing list