Skip to content

Commit 126e798

Browse files
atscottthePunderWoman
authored andcommitted
docs(common): Add note to location about investigating base href handling (#48422)
There have been/are several bugs related to base href handling in Angular (#45744, #48175, #19296). These all stem from the attempted custom handling of base href in the `Location` class. This logic does not really make an attempt to be fully compliant with the spec. PR Close #48422
1 parent 85d3f6f commit 126e798

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎packages/common/src/location/location.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ export class Location implements OnDestroy {
6868
constructor(locationStrategy: LocationStrategy) {
6969
this._locationStrategy = locationStrategy;
7070
const baseHref = this._locationStrategy.getBaseHref();
71+
// Note: This class's interaction with base HREF does not fully follow the rules
72+
// outlined in the spec https://www.freesoft.org/CIE/RFC/1808/18.htm.
73+
// Instead of trying to fix individual bugs with more and more code, we should
74+
// investigate using the URL constructor and providing the base as a second
75+
// argument.
76+
// https://developer.mozilla.org/en-US/docs/Web/API/URL/URL#parameters
7177
this._basePath = _stripOrigin(stripTrailingSlash(_stripIndexHtml(baseHref)));
7278
this._locationStrategy.onPopState((ev) => {
7379
this._subject.emit({

0 commit comments

Comments
 (0)