From 22af7691003da508e285c7c85e019ac42b3e6d21 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sun, 28 Nov 2010 22:40:21 -0800 Subject: [PATCH] only detect ie outside the browser --- lib/index.js | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/lib/index.js b/lib/index.js index 14b8a10..e7e50e5 100644 --- a/lib/index.js +++ b/lib/index.js @@ -9,19 +9,25 @@ // - authentication and write APIs (function() { - var ie = (function() { - var undef - , v = 3 - , div = document.createElement('div') - , all = div.getElementsByTagName('i') + var global = this + , isBrowser = 'document' in global + , ie - while ( - div.innerHTML = '', - all[0] - ); + if (isBrowser) { + ie = (function() { + var undef + , v = 3 + , div = document.createElement('div') + , all = div.getElementsByTagName('i') - return v > 4 ? v : undef - }()) + while ( + div.innerHTML = '', + all[0] + ); + + return v > 4 ? v : undef + }()) + } var inherits if ('create' in Object) { @@ -55,10 +61,8 @@ } } - var global = this - , isBrowser = 'document' in global - // when running in the browser request is set later - , request = isBrowser ? null : require('request') + // when running in the browser request is set later + var request = isBrowser ? null : require('request') , Blob, Branch, Commit, Raw, Repo, Tree, User , api