Skip to content

Commit 778682a

Browse files
committed
Tidy up the way 'strict' mode is triggered.
1 parent ebdb2ab commit 778682a

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

jquery.url.js

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -87,28 +87,23 @@
8787
url = $(this).attr( getAttrName(this[0]) ) || '';
8888
}
8989

90-
return $.url({ url : url, strict : strictMode });
90+
return $.url( url, strictMode );
9191
};
9292

93-
$.url = function( opts )
93+
$.url = function( url, strictMode )
9494
{
95-
var url = '',
96-
strict = false;
97-
98-
if ( typeof opts === 'string' )
99-
{
100-
url = opts;
101-
}
102-
else
103-
{
104-
opts = opts || {};
105-
strict = opts.strict || strict;
106-
url = opts.url === undefined ? window.location.toString() : opts.url;
107-
}
108-
95+
if ( arguments.length === 1 && url === true )
96+
{
97+
strictMode = true;
98+
url = undefined;
99+
}
100+
101+
strictMode = strictMode || false;
102+
url = url || window.location.toString();
103+
109104
return {
110105

111-
data : parseUri(url, strict),
106+
data : parseUri(url, strictMode),
112107

113108
// get various attributes from the URI
114109
attr : function( attr )

0 commit comments

Comments
 (0)