diff --git a/build/page.js b/build/page.js index 858cb7a4..e90d71e9 100755 --- a/build/page.js +++ b/build/page.js @@ -88,7 +88,7 @@ if (false !== options.popstate) addEventListener('popstate', onpopstate, false); if (false !== options.click) addEventListener('click', onclick, false); if (!dispatch) return; - page.replace(location.pathname, null, true, dispatch); + page.replace(location.pathname + location.search, null, true, dispatch); }; /** @@ -264,8 +264,10 @@ Route.prototype.match = function(path, params){ var keys = this.keys - , m = this.regexp.exec(path); - + , qsIndex = path.indexOf('?') + , pathname = ~qsIndex ? path.slice(0, qsIndex) : path + , m = this.regexp.exec(pathname); + if (!m) return false; for (var i = 1, len = m.length; i < len; ++i) { @@ -348,7 +350,7 @@ while (el && 'A' != el.nodeName) el = el.parentNode; if (!el || 'A' != el.nodeName) return; var href = el.href; - var path = el.pathname; + var path = el.pathname + el.search; if (el.hash) return; if (!sameOrigin(href)) return; var orig = path; diff --git a/build/page.min.js b/build/page.min.js index ba6307d7..3f39c8f2 100644 --- a/build/page.min.js +++ b/build/page.min.js @@ -1 +1 @@ -(function(){var dispatch=!0,base="",running;function page(path,fn){if("function"==typeof fn){var route=new Route(path);for(var i=1;i