I apologize if I missed an existing issue for this, or if this is expected behavior, but it seems surprising to me. #575 is similar but this is specifically around pathname and base URL. Assuming hashbang is false, if there is no hash symbol (anchor) in the document URL, the pathname is based on path so includes the base URL. In Context():
|
this.pathname = _page._decodeURLEncodedURIComponent(~i ? path.slice(0, i) : path); |
However, if there is a hash symbol (anchor), pathname depends on this.path, which does not have the base URL.
|
this.path = this.pathname = parts[0]; |
I came across while tracking a bug in our code. Here is a gist which shows the behavior in isolation.
https://gist.github.com/evanbattaglia/2b76bf11fe8a18ac4dcef14f2138a2cc
URL: /index -> pathname /basic/
URL: /index#whoop -> pathname /
URL: /basic/about -> pathname /basic/about
URL: /basic/about#whoop -> pathname /about
The documentation states pathname is The pathname void of query string "/login"., which implies it should not have the base URL (/admin in the documentation).
I apologize if I missed an existing issue for this, or if this is expected behavior, but it seems surprising to me. #575 is similar but this is specifically around pathname and base URL. Assuming
hashbangis false, if there is no hash symbol (anchor) in the document URL, the pathname is based onpathso includes the base URL. In Context():page.js/page.js
Line 1090 in 4f99916
However, if there is a hash symbol (anchor), pathname depends on
this.path, which does not have the base URL.page.js/page.js
Line 1098 in 4f99916
I came across while tracking a bug in our code. Here is a gist which shows the behavior in isolation.
https://gist.github.com/evanbattaglia/2b76bf11fe8a18ac4dcef14f2138a2cc
URL:
/index-> pathname/basic/URL:
/index#whoop-> pathname/URL:
/basic/about-> pathname/basic/aboutURL:
/basic/about#whoop-> pathname/aboutThe documentation states pathname is
The pathname void of query string "/login"., which implies it should not have the base URL (/adminin the documentation).