diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2011-05-23 06:31:39 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2011-05-23 06:31:39 +0000 |
commit | bc2aa6314a8d82854a799fe1e750c05dcef1b492 (patch) | |
tree | 0fcda568552ed214683230b81793a9f69a467db1 /sca-cpp/trunk/modules/js/htdocs/util.js | |
parent | 4aa0b8bca183523fab66e655ae6652bfea42255d (diff) |
Some Javascript cleanup, now working across all browsers including IE9.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1126329 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/js/htdocs/util.js')
-rw-r--r-- | sca-cpp/trunk/modules/js/htdocs/util.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sca-cpp/trunk/modules/js/htdocs/util.js b/sca-cpp/trunk/modules/js/htdocs/util.js index 69359fa167..b74eedc6ed 100644 --- a/sca-cpp/trunk/modules/js/htdocs/util.js +++ b/sca-cpp/trunk/modules/js/htdocs/util.js @@ -208,6 +208,16 @@ function debug(o) { } /** + * Return true if the current browser is Internet Explorer. + */ +function isIE() { + if (typeof isIE.detected != 'undefined') + return isIE.detected; + isIE.detected = navigator.appName == 'Microsoft Internet Explorer'; + return isIE.detected; +}; + +/** * External build configuration. */ var config; @@ -267,15 +277,17 @@ function writeValue(v) { * Apply a function and memoize its result. */ function memo(obj, key, f) { - if (!obj[memo]) + if (!('memo' in obj)) { obj.memo = {}; - if (obj.memo[key]) + return obj.memo[key] = f(); + } + if (key in obj.memo) return obj.memo[key]; return obj.memo[key] = f(); } /** - * Un-memoize store results. + * Un-memoize stored results. */ function unmemo(obj) { obj.memo = {}; |