@@ -1410,16 +1410,30 @@ Docs at http://horizontal-timeline.ycodetech.co.uk
14101410 css = type == 'css' ;
14111411
14121412 // If js, check if the lowercase form of the name is in a src attribute in a <script> tag
1413- if ( js ) fileExists = $ ( 'script[src*="' + name + '" i]' ) ;
1413+ if ( js )
1414+ // Using fileExists = $('script[src*="'+name+'" i]'); would be more appropriate,
1415+ // but due to lack of browser support, it can't be used yet.
1416+ fileExists = $ ( 'link[href*="' + name + '"' ) . filter ( function ( ) {
1417+ return this . value . toLowerCase ( ) == name ;
1418+ } ) ;
1419+
14141420 // Else if css, check if the lowercase form of the name is in a href attribute in a <link> tag
1415- else if ( css ) fileExists = $ ( 'link[href*="' + name + '" i]' ) ;
1421+ else if ( css )
1422+ // Using fileExists = $('link[href*="'+name+'" i]'); would be more appropriate,
1423+ // but due to lack of browser support, it can't be used yet.
1424+ fileExists = $ ( 'link[href*="' + name + '"' ) . filter ( function ( ) {
1425+ return this . value . toLowerCase ( ) == name ;
1426+ } ) ;
14161427
14171428 // If loadedFile is undefined/not set, create a new array for the loaded files.
14181429 if ( loadedFile == undefined ) loadedFile = new Array ( ) ;
14191430
14201431 // If loadedFile array doesn't include the url AND
14211432 // the file doesn't exist in the document...
1422- if ( ! loadedFile . includes ( url ) && ! fileExists . length ) {
1433+
1434+ // Using !loadedFile.includes(url) would be more ideal,
1435+ // but due to no support in IE11, we can't use it.
1436+ if ( loadedFile . indexOf ( url ) == - 1 && ! fileExists . length ) {
14231437 // File isn't loaded yet...
14241438 // If adding js...
14251439 if ( js ) {
@@ -1449,7 +1463,10 @@ Docs at http://horizontal-timeline.ycodetech.co.uk
14491463 }
14501464 // Else if the file exists in the document AND
14511465 // the URL isn't in the loadedFile array...
1452- else if ( fileExists . length && ! loadedFile . includes ( url ) ) {
1466+
1467+ // Using !loadedFile.includes(url) would be more ideal,
1468+ // but due to no support in IE11, we can't use it.
1469+ else if ( fileExists . length && loadedFile . indexOf ( url ) == - 1 ) {
14531470 // The file is already loaded in the document via a <script> tag...
14541471 if ( js ) {
14551472 console . log ( name + ' has already been loaded by a <script> tag in the document, no need to load it again. Timeline instance:' , this . $element ) ;
0 commit comments