File tree 1 file changed +8
-12
lines changed
1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -95,21 +95,17 @@ export const qwikLoader = (
95
95
const attrValue = element [ getAttribute ] ( attrName ) ;
96
96
if ( attrValue ) {
97
97
const container = element . closest ( '[q\\:container]' ) ! as QContainerElement ;
98
- const baseURI = new URL ( doc . baseURI ) ;
99
- const qBase = container [ getAttribute ] ( 'q:base' ) ! ;
100
98
const qVersion = container [ getAttribute ] ( 'q:version' ) || 'unknown' ;
101
99
const qManifest = container [ getAttribute ] ( 'q:manifest-hash' ) || 'dev' ;
102
- const base = new URL ( qBase ?? baseURI , baseURI ) ;
100
+ const base = container [ getAttribute ] ( 'q:base' ) ;
101
+ let base = qBase ;
102
+ if ( ! base || base === '/' ) {
103
+ base = doc . baseURI ;
104
+ } else {
105
+ base = base . endsWith ( '/' ) ? base : base + '/' ;
106
+ }
103
107
for ( const qrl of attrValue . split ( '\n' ) ) {
104
- const isStartSlash = qrl . toString ( ) . startsWith ( '/' ) ;
105
- const isEndslash = base . pathname . endsWith ( '/' ) ;
106
- const pathUrl =
107
- ( isEndslash && ! isStartSlash
108
- ? base . pathname
109
- : isEndslash
110
- ? base . pathname . slice ( 0 , - 1 )
111
- : base . pathname ) + qrl ;
112
- const url = new URL ( pathUrl , ! base . origin ? base : base . origin ) ;
108
+ const url = new URL ( qrl , base ) ;
113
109
const href = url . href ;
114
110
const symbol = url . hash [ replace ] ( / ^ # ? ( [ ^ ? [ | ] * ) .* $ / , '$1' ) || 'default' ;
115
111
const reqTime = performance . now ( ) ;
You can’t perform that action at this time.
0 commit comments