one-validation
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -14,3 +14,3 @@ { | ||
"description": "Regexp based validation collection for common internet validation tasks", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"repository": { | ||
@@ -17,0 +17,0 @@ "url": "git://github.com/One-com/one-validation.git" |
@@ -18,2 +18,5 @@ /*global beforeEach, describe, it*/ | ||
expect('http://www.foo.com/', 'to pass'); | ||
expect('http://www.foo.com?query=simple', 'to pass'); | ||
expect('http://www.foo.com?query=where&is=theTruth', 'to pass'); | ||
expect('http://www.foo.com?query=where&is=theTruth#in=the&world=true', 'to pass'); | ||
expect('http://www.foo.com/~username/', 'to pass'); | ||
@@ -20,0 +23,0 @@ expect('http://www.foo.com/?', 'to pass'); |
@@ -80,6 +80,9 @@ /*global module, define*/ | ||
// Same as location.pathname + location.search + location.hash in the browser: | ||
fragments.searchHash = new RegExp(concatRegExps( | ||
'(?:\\?', fragments.search, ')?', | ||
'(?:#', fragments.hash, ')?' | ||
)); | ||
fragments.pathnameSearchHash = new RegExp(concatRegExps( | ||
'(?:/', fragments.pathname, | ||
'(?:\\?', fragments.search, ')?', | ||
'(?:#', fragments.hash, ')?', | ||
'(?:', fragments.pathname, | ||
fragments.searchHash, | ||
')?' // See http://www.ietf.org/rfc/rfc1738.txt | ||
@@ -89,3 +92,6 @@ )); | ||
// Root-relative URL. Same as pathnameSearchHash, except it can't be empty | ||
fragments.rootRelativeUrl = new RegExp(fragments.pathnameSearchHash.source.replace(/\?$/, '')); | ||
fragments.rootRelativeUrl = new RegExp(concatRegExps( | ||
'/', | ||
new RegExp(fragments.pathnameSearchHash.source.replace(/\?$/, '') | ||
))); | ||
@@ -110,3 +116,3 @@ function createHttpishUrlRegExp(options) { | ||
'(?::', fragments.port, ')?', | ||
fragments.pathnameSearchHash | ||
'(?:/', fragments.pathnameSearchHash, '|', fragments.searchHash, ')' | ||
), 'i'); | ||
@@ -113,0 +119,0 @@ } |
28941
346