Merge pull request #81 from mrvdb/codehighlight
Resolve an edge case where last language has error
This commit is contained in:
commit
2f683e783e
|
@ -22,8 +22,12 @@
|
||||||
var sc = document.createElement('script');
|
var sc = document.createElement('script');
|
||||||
sc.src = uri;
|
sc.src = uri;
|
||||||
sc.async = false; // critical?
|
sc.async = false; // critical?
|
||||||
|
// Set callback on last script
|
||||||
if (uris.indexOf(uri) == uris.length-1) {
|
if (uris.indexOf(uri) == uris.length-1) {
|
||||||
sc.onload = callback;
|
// Set callback regardless
|
||||||
|
// so we're sure it will run if last element had error
|
||||||
|
// (we only know after loading, so we've had load time already)
|
||||||
|
sc.onload = callback; sc.onerror = callback;
|
||||||
}
|
}
|
||||||
document.head.appendChild(sc);
|
document.head.appendChild(sc);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue