diff --git a/path.js b/path.js index d56a2d8..95748ce 100644 --- a/path.js +++ b/path.js @@ -65,7 +65,9 @@ var Path = { for (i = 0; i < slice.split("/").length; i++) { if ((i < compare.split("/").length) && (slice.split("/")[i].charAt(0) === ":")) { params[slice.split('/')[i].replace(/:/, '')] = compare.split("/")[i]; - compare = compare.replace(compare.split("/")[i], slice.split("/")[i]); + var compare_array = compare.split("/"); + compare_array[i] = slice.split("/")[i]; + compare = compare_array.join("/"); } } } @@ -177,7 +179,7 @@ Path.core.route.prototype = { if (Path.routes.defined[this.path].hasOwnProperty("do_enter")) { if (Path.routes.defined[this.path].do_enter.length > 0) { for (i = 0; i < Path.routes.defined[this.path].do_enter.length; i++) { - result = Path.routes.defined[this.path].do_enter[i].apply(this, null); + result = Path.routes.defined[this.path].do_enter[i].apply(this); if (result === false) { halt_execution = true; break; diff --git a/tests/path.js.test.html b/tests/path.js.test.html index 9d870fa..54d0fc6 100644 --- a/tests/path.js.test.html +++ b/tests/path.js.test.html @@ -2,22 +2,23 @@