@@ -18,7 +18,7 @@ import { parse } from './parse.js';
18
18
import * as storage from './session-storage.js' ;
19
19
import {
20
20
find_anchor ,
21
- get_base_uri ,
21
+ resolve_url ,
22
22
get_link_info ,
23
23
get_router_options ,
24
24
is_external_url ,
@@ -235,12 +235,8 @@ export function create_client(app, target) {
235
235
redirect_count ,
236
236
nav_token
237
237
) {
238
- if ( typeof url === 'string' ) {
239
- url = new URL ( url , get_base_uri ( document ) ) ;
240
- }
241
-
242
238
return navigate ( {
243
- url,
239
+ url : resolve_url ( url ) ,
244
240
scroll : noScroll ? scroll_state ( ) : null ,
245
241
keepfocus : keepFocus ,
246
242
redirect_count,
@@ -1375,21 +1371,20 @@ export function create_client(app, target) {
1375
1371
}
1376
1372
} ,
1377
1373
1378
- goto : ( href , opts = { } ) => {
1379
- if ( typeof href === 'string' ) {
1380
- href = new URL ( href , get_base_uri ( document ) ) ;
1381
- }
1382
- if ( href . origin !== origin ) {
1374
+ goto : ( url , opts = { } ) => {
1375
+ url = resolve_url ( url ) ;
1376
+
1377
+ if ( url . origin !== origin ) {
1383
1378
return Promise . reject (
1384
1379
new Error (
1385
1380
DEV
1386
- ? `Cannot use \`goto\` with an external URL. Use \`window.location = "${ href } "\` instead`
1381
+ ? `Cannot use \`goto\` with an external URL. Use \`window.location = "${ url } "\` instead`
1387
1382
: 'goto: invalid URL'
1388
1383
)
1389
1384
) ;
1390
1385
}
1391
1386
1392
- return goto ( href , opts , 0 ) ;
1387
+ return goto ( url , opts , 0 ) ;
1393
1388
} ,
1394
1389
1395
1390
invalidate : ( resource ) => {
@@ -1409,7 +1404,7 @@ export function create_client(app, target) {
1409
1404
} ,
1410
1405
1411
1406
preload_data : async ( href ) => {
1412
- const url = new URL ( href , get_base_uri ( document ) ) ;
1407
+ const url = resolve_url ( href ) ;
1413
1408
const intent = get_navigation_intent ( url , false ) ;
1414
1409
1415
1410
if ( ! intent ) {
0 commit comments