From 1911dba7d7f9e1262eeb13095dd67567655a61b7 Mon Sep 17 00:00:00 2001 From: John Bender Date: Sat, 12 Mar 2011 14:07:18 -0800 Subject: [PATCH] small refactor for clean --- js/jquery.mobile.navigation.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/jquery.mobile.navigation.js b/js/jquery.mobile.navigation.js index 40803695..ee8dbc27 100644 --- a/js/jquery.mobile.navigation.js +++ b/js/jquery.mobile.navigation.js @@ -47,9 +47,10 @@ //return a url path with the window's location protocol/hostname removed clean: function( url ){ - // Replace the protocol and host only once at the beginning of the path to avoid + // Replace the protocol and host only once at the beginning of the url to avoid // problems when it's included as a part of a param - return url.replace(new RegExp("^" + location.protocol + "//" + location.host), ""); + var leadingUrlRootRegex = new RegExp("^" + location.protocol + "//" + location.host); + return url.replace(leadingUrlRootRegex, ""); }, //just return the url without an initial #