This repository was archived by the owner on Dec 28, 2024. It is now read-only.
Commit e7ef3ae 1 parent d4aa275 commit e7ef3ae Copy full SHA for e7ef3ae
File tree 1 file changed +12
-5
lines changed
1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 324
324
if ( this . src === '' ) {
325
325
return '' ;
326
326
}
327
-
328
- var pathComponents = ( new URL ( this . _resolveSrc ( this . src ) ) ) . pathname . split ( "/" ) ;
329
- return pathComponents [ pathComponents . length - 1 ] ;
327
+ // Avoid using new URL since it is not supported in IE.
328
+ var resolved = this . _resolveSrc ( this . src ) ;
329
+ // Remove query parts, get file name.
330
+ return resolved . replace ( / [ ? | # ] .* / g, '' ) . split ( '/' ) . pop ( ) ;
330
331
} ,
331
332
332
333
_computeImgHidden : function ( ) {
388
389
} ,
389
390
390
391
_resolveSrc : function ( testSrc ) {
391
- var baseURI = this . $ . baseURIAnchor . href ;
392
- return ( new URL ( Polymer . ResolveUrl . resolveUrl ( testSrc , baseURI ) , baseURI ) ) . href ;
392
+ var resolved = Polymer . ResolveUrl . resolveUrl ( testSrc , this . $ . baseURIAnchor . href ) ;
393
+ // Avoid using new URL since it is not supported in IE.
394
+ if ( resolved [ 0 ] === '/' ) {
395
+ // In IE location.origin might not work
396
+ // https://connect.microsoft.com/IE/feedback/details/1763802/location-origin-is-undefined-in-ie-11-on-windows-10-but-works-on-windows-7
397
+ resolved = ( location . origin || location . protocol + '//' + location . host ) + resolved ;
398
+ }
399
+ return resolved ;
393
400
}
394
401
} ) ;
395
402
</ script >
You can’t perform that action at this time.
0 commit comments