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 {
90
90
91
91
if ( anchorTarget && canProcessAnchor ( anchorTarget ) ) {
92
92
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
- }
97
93
98
94
const absoluteHref = toAbsoluteUri ( anchorHref ) ;
99
95
Original file line number Diff line number Diff line change @@ -1547,7 +1547,7 @@ public void CanNavigateBetweenPagesWithQueryStrings()
1547
1547
}
1548
1548
1549
1549
[ Fact ]
1550
- public void AnchorWithHrefStartingWithHash_ScrollsToElementWithIdOnTheSamePage ( )
1550
+ public void AnchorWithHrefContainingHashSamePage_ScrollsToElementWithIdOnTheSamePage ( )
1551
1551
{
1552
1552
SetUrlViaPushState ( "/" ) ;
1553
1553
var app = Browser . MountTestComponent < TestRouter > ( ) ;
@@ -1563,7 +1563,7 @@ public void AnchorWithHrefStartingWithHash_ScrollsToElementWithIdOnTheSamePage()
1563
1563
}
1564
1564
1565
1565
[ Fact ]
1566
- public void AnchorWithHrefContainingHash_NavigatesToPageAndScrollsToElementWithName ( )
1566
+ public void AnchorWithHrefContainingHashAnotherPage_NavigatesToPageAndScrollsToElementWithName ( )
1567
1567
{
1568
1568
SetUrlViaPushState ( "/" ) ;
1569
1569
var app = Browser . MountTestComponent < TestRouter > ( ) ;
Original file line number Diff line number Diff line change 1
1
@page " /LongPageWithHash"
2
2
@inject NavigationManager NavigationManager
3
3
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 >
5
5
<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 >
7
7
<br />
8
8
<button id =" navigate-test1" class =" btn btn-primary" @onclick =" GoToTest1" >NavigationManager.NavigatteTo same page #test1</button >
9
9
<br />
22
22
@code {
23
23
void GoToTest1 ()
24
24
{
25
- NavigationManager .NavigateTo (" /subdir/ LongPageWithHash#test1" );
25
+ NavigationManager .NavigateTo (" LongPageWithHash#test1" );
26
26
}
27
27
28
28
void GoToTest2 ()
29
29
{
30
- NavigationManager .NavigateTo (" /subdir/ LongPageWithHash2#test2" );
30
+ NavigationManager .NavigateTo (" LongPageWithHash2#test2" );
31
31
}
32
32
}
You can’t perform that action at this time.
0 commit comments