[Pkg-javascript-commits] [backbone] 35/37: merging in setDomLibrary

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 17:02:49 UTC 2014


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

js pushed a commit to tag 0.9.1
in repository backbone.

commit 0ffd7ea2cafa64676ea5f275c5bf900c76af286a
Merge: 8a427f3 e97c58f
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date:   Thu Feb 2 16:30:56 2012 -0500

    merging in setDomLibrary

 backbone.js           | 19 +++++++++++++++++++
 test/setdomlibrary.js | 30 ++++++++++++++++++++++++++++++
 test/test.html        |  1 +
 3 files changed, 50 insertions(+)

diff --cc backbone.js
index 2eed82d,40cee89..3da23a2
--- a/backbone.js
+++ b/backbone.js
@@@ -39,8 -38,27 +39,27 @@@
    if (!_ && (typeof require !== 'undefined')) _ = require('underscore');
  
    // For Backbone's purposes, jQuery, Zepto, or Ender owns the `$` variable.
 -  var $ = root.jQuery || root.Zepto || root.ender;
 +  var $ = root.jQuery || root.Zepto || root.ender || root.$;
  
+ 
+   // Set the javascript library that will be used for the selector work
+   // (a.k.a. the `$` variable).
+   //
+   // By default Backbone will use: jQuery, Zepto, or Ender; but the `setDomLibrary()`
+   // method let's you inject an alternate javascript library (or a mock
+   // library for testing your views outside of a browser). This is also useful
+   // if you are using a packaging library -- to add support for `require()`
+   // calls in the browser (e.g. ender or browserify). The scoping used to
+   // support `require()`, prevents Backbone from automatically loading the
+   // default javascript library.
+   //
+   //     Backbone.setDomLibrary(jQuery)
+   //
+   Backbone.setDomLibrary = function(lib) {
+     $ = lib;
+   };
+ 
+ 
    // Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable
    // to its previous owner. Returns a reference to this Backbone object.
    Backbone.noConflict = function() {

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