File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ export default class Source {
52
52
}
53
53
54
54
get className ( ) {
55
- return `image-${ toHashHex ( this . src ) } ` ;
55
+ return `image-${ toHashHex ( normalizeSrc ( this . src ) ) } ` ;
56
56
}
57
57
58
58
get style ( ) {
@@ -124,3 +124,11 @@ function getFormat(src, format) {
124
124
}
125
125
return format || extension ;
126
126
}
127
+
128
+ export function normalizeSrc ( src ) {
129
+ if ( src . startsWith ( '/' ) ) {
130
+ return src ;
131
+ }
132
+ const url = new URL ( src ) ;
133
+ return url . pathname + url . search + url . hash ;
134
+ }
Original file line number Diff line number Diff line change 1
- import Source from '../../SpeedkitImage/classes/Source' ;
1
+ import Source , { normalizeSrc } from '../../SpeedkitImage/classes/Source' ;
2
2
import createSort from '#speedkit/externals/create-sort' ;
3
3
import { toHashHex } from '#speedkit/utils/string' ;
4
4
@@ -52,7 +52,7 @@ export default class SourceList {
52
52
}
53
53
54
54
get className ( ) {
55
- return `picture-${ toHashHex ( this . sorted . map ( ( { src } ) => src ) . join ( ',' ) ) } ` ;
55
+ return `picture-${ toHashHex ( this . sorted . map ( ( { src } ) => normalizeSrc ( src ) ) . join ( ',' ) ) } ` ;
56
56
}
57
57
58
58
get classNames ( ) {
You can’t perform that action at this time.
0 commit comments