aino/galleria — Issue #234: Utils.getScriptPath implementation and async script loading
Author: ximus
Created: 2012-01-10 00:12:53+00:00
State: open

Hi

Utils.getScriptPath is written in a way which assumes that scripts are downloaded and executed sequentially by browsers. However this is not always the case anymore as more developers add `defer` and `async` attributes to their script tags.

The following bit in galleria.js [line 192](https://github.com/aino/galleria/blob/master/src/galleria.js#L193):

```javascript
// the currently executing script is always the last
src = src || $('script:last').attr('src');
```

is not correct anymore, the currently loaded script is not necessarily the current. The pattern of downloading scripts asynchronously enhances the web experience and galleria should allow for it. It seems only the Flickr plugin invokes this function.

I'm not sure how to correct this though.