From fcba955d82d625aca80ef90baef774370df3b31a Mon Sep 17 00:00:00 2001 From: Morgan Cheng Date: Fri, 29 Apr 2011 20:07:14 -0700 Subject: [PATCH] cache user agent detection result. --- src/bowser.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/bowser.js b/src/bowser.js index 252321e..9c1e4f7 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -14,9 +14,15 @@ safari = /safari/i.test(ua) && !chrome, opera = /opera/i.test(ua), firefox = /firefox/i.test(ua), - gecko = /gecko\//i.test(ua); + gecko = /gecko\//i.test(ua), + info; function bowser() { + info = info ? info : detect(); + return info; + } + + function detect() { if (ie) { return {