Permalink
Browse files

make bonzo an optional dependency (try/catch)

  • Loading branch information...
rvagg committed Dec 5, 2011
1 parent adec94d commit 69dc510315eae88445534014041eb6f3077d26f0
Showing with 11 additions and 27 deletions.
  1. +0 −21 integration/ender.min.js
  2. +1 −1 integration/integration.html
  3. +10 −5 src/ender.js
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -23,4 +23,4 @@
</ul>
</div>
</body>
-</html>
+</html>
View
@@ -1,5 +1,5 @@
!function (doc, $) {
- var q = require('qwery'), b
+ var q = require('qwery')
$.pseudos = q.pseudos
@@ -8,10 +8,15 @@
// rather than load-time since technically it's not a dependency and
// can be loaded in any order
// hence the lazy function re-definition
- $._select = !(b = require('bonzo')) ? q : function (s, r) {
- return /^\s*</.test(s) ? b.create(s, r) : q(s, r)
- }
- return b && /^\s*</.test(s) ? b.create(s, r) : q(s, r)
+ return ($._select = (function(b) {
+ try {
+ b = require('bonzo')
+ return function (s, r) {
+ return /^\s*</.test(s) ? b.create(s, r) : q(s, r)
+ }
+ } catch (e) { }
+ return q
+ })())(s, r)
}
$.ender({

0 comments on commit 69dc510

Please sign in to comment.