diff options
author | cash <cash.costello@gmail.com> | 2011-11-05 15:05:13 -0400 |
---|---|---|
committer | cash <cash.costello@gmail.com> | 2011-11-05 15:05:13 -0400 |
commit | 604a3bc06281de721e27561341299f1bb9f8ea51 (patch) | |
tree | 544ea5b087c637c1ec6bbb9adc48f5dae1fda1bc /js/lib | |
parent | 12599e74e44cd9d2ee2c7dbc8b4950fd54aca789 (diff) | |
download | elgg-604a3bc06281de721e27561341299f1bb9f8ea51.tar.gz elgg-604a3bc06281de721e27561341299f1bb9f8ea51.tar.bz2 |
Fixes #3976 fixed unit tests for normalizing urls and standardized the code from the previous merge
Diffstat (limited to 'js/lib')
-rw-r--r-- | js/lib/elgglib.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/js/lib/elgglib.js b/js/lib/elgglib.js index 3e38bbad6..ca7914e7c 100644 --- a/js/lib/elgglib.js +++ b/js/lib/elgglib.js @@ -224,8 +224,8 @@ elgg.provide = function(pkg, opt_context) { * child.foo('boo!'); // alert('boo!'); * </pre> * - * @param {Function} childCtor Child class. - * @param {Function} parentCtor Parent class. + * @param {Function} Child Child class constructor. + * @param {Function} Parent Parent class constructor. */ elgg.inherit = function(Child, Parent) { Child.prototype = new Parent(); @@ -250,17 +250,17 @@ elgg.normalize_url = function(url) { url = url || ''; elgg.assertTypeOf('string', url); - validated = (function(url){ + validated = (function(url) { url = elgg.parse_url(url); - if(url.scheme){ + if (url.scheme){ url.scheme = url.scheme.toLowerCase(); } - if(url.scheme == 'http' || url.scheme == 'https') { - if(!url.host) { + if (url.scheme == 'http' || url.scheme == 'https') { + if (!url.host) { return false; } /* hostname labels may contain only alphanumeric characters, dots and hypens. */ - if(!(new RegExp("^([a-zA-Z0-9][a-zA-Z0-9\\-\\.]*)$", "i")).test(url.host) || url.host.charAt(-1) == '.'){ + if (!(new RegExp("^([a-zA-Z0-9][a-zA-Z0-9\\-\\.]*)$", "i")).test(url.host) || url.host.charAt(-1) == '.') { return false; } } |