[Pkg-javascript-commits] [backbone] 151/211: Adding Backbone.Router.setLocation, alongside saveLocation, to both save and route at once.

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 17:00:17 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 e5ee5503fd388b7fd6efccef829545e0af7b047b
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date:   Thu May 26 12:02:12 2011 -0400

    Adding Backbone.Router.setLocation, alongside saveLocation, to both save and route at once.
---
 backbone.js | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/backbone.js b/backbone.js
index 6cfffd3..ea8095f 100644
--- a/backbone.js
+++ b/backbone.js
@@ -578,8 +578,9 @@
       if (!model.collection) {
         model.collection = this;
       }
-      var index = this.comparator ? this.sortedIndex(model, this.comparator) :
-                  options.at != null ? options.at : this.length;
+      var index = options.at != null ? options.at :
+                  this.comparator ? this.sortedIndex(model, this.comparator) :
+                  this.length;
       this.models.splice(index, 0, model);
       model.bind('all', this._onModelEvent);
       this.length++;
@@ -689,9 +690,8 @@
     },
 
     // Simple proxy to `Backbone.history` to both save a fragment into the
-    // history and to then load the route at that fragment. Used in place
-    // of settings `window.location.hash` when using `window.history.pushState`.
-    loadUrl : function(fragment) {
+    // history and to then load the route at that fragment.
+    setLocation : function(fragment) {
       Backbone.history.saveLocation(fragment);
       Backbone.history.loadUrl();
     },

-- 
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