File tree Expand file tree Collapse file tree 3 files changed +6
-10
lines changed
testassets/BasicTestApp/RouterTest Expand file tree Collapse file tree 3 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -90,10 +90,6 @@ export function attachToEventDelegator(eventDelegator: EventDelegator): void {
9090
9191 if ( anchorTarget && canProcessAnchor ( anchorTarget ) ) {
9292 let anchorHref = anchorTarget . getAttribute ( 'href' ) ! ;
93- if ( anchorHref . startsWith ( '#' ) ) {
94- // Preserve the existing URL but set the hash to match the link that was clicked
95- anchorHref = `${ location . origin } ${ location . pathname } ${ location . search } ${ anchorHref } ` ;
96- }
9793
9894 const absoluteHref = toAbsoluteUri ( anchorHref ) ;
9995
Original file line number Diff line number Diff line change @@ -1547,7 +1547,7 @@ public void CanNavigateBetweenPagesWithQueryStrings()
15471547 }
15481548
15491549 [ Fact ]
1550- public void AnchorWithHrefStartingWithHash_ScrollsToElementWithIdOnTheSamePage ( )
1550+ public void AnchorWithHrefContainingHashSamePage_ScrollsToElementWithIdOnTheSamePage ( )
15511551 {
15521552 SetUrlViaPushState ( "/" ) ;
15531553 var app = Browser . MountTestComponent < TestRouter > ( ) ;
@@ -1563,7 +1563,7 @@ public void AnchorWithHrefStartingWithHash_ScrollsToElementWithIdOnTheSamePage()
15631563 }
15641564
15651565 [ Fact ]
1566- public void AnchorWithHrefContainingHash_NavigatesToPageAndScrollsToElementWithName ( )
1566+ public void AnchorWithHrefContainingHashAnotherPage_NavigatesToPageAndScrollsToElementWithName ( )
15671567 {
15681568 SetUrlViaPushState ( "/" ) ;
15691569 var app = Browser . MountTestComponent < TestRouter > ( ) ;
Original file line number Diff line number Diff line change 11@page " /LongPageWithHash"
22@inject NavigationManager NavigationManager
33
4- <a id =" anchor-test1" href =" #test1" >Go to test1 on this page</a >
4+ <a id =" anchor-test1" href =" LongPageWithHash #test1" >Go to test1 on this page</a >
55<br />
6- <a id =" anchor-test2" href =" /subdir/ LongPageWithHash2#test2" >Go to test2 on LongPageWithHash2 page</a >
6+ <a id =" anchor-test2" href =" LongPageWithHash2#test2" >Go to test2 on LongPageWithHash2 page</a >
77<br />
88<button id =" navigate-test1" class =" btn btn-primary" @onclick =" GoToTest1" >NavigationManager.NavigatteTo same page #test1</button >
99<br />
2222@code {
2323 void GoToTest1 ()
2424 {
25- NavigationManager .NavigateTo (" /subdir/ LongPageWithHash#test1" );
25+ NavigationManager .NavigateTo (" LongPageWithHash#test1" );
2626 }
2727
2828 void GoToTest2 ()
2929 {
30- NavigationManager .NavigateTo (" /subdir/ LongPageWithHash2#test2" );
30+ NavigationManager .NavigateTo (" LongPageWithHash2#test2" );
3131 }
3232}
You can’t perform that action at this time.
0 commit comments