Permalink
Browse files

fix getScriptInfo to specifically find vogue-client.js instead of ass…

…uming it's the last entry in scripts array
  • Loading branch information...
1 parent de5a05f commit 6427d31104ced949b75f5f343af6caa433632d51 @anentropic anentropic committed Nov 5, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/client/vogue-client.js
@@ -228,8 +228,10 @@
scripts, src, rootUrl, baseMatch;
if (typeof window.__vogue__ === "undefined") {
scripts = document.getElementsByTagName("script");
- // The last parsed script will be our script.
- src = scripts[scripts.length - 1].getAttribute("src");
+ for (var i=0; i < scripts.length; i++) {
+ src = scripts[i].getAttribute("src");
+ if (src.slice(-15) == 'vogue-client.js') break;
+ }
rootUrl = src.match(/^https?\:\/\/(.*?)\//)[0];
// There is an optional base argument, that can be used.
baseMatch = src.match(/\bbase=(.*)(&|$)/);

0 comments on commit 6427d31

Please sign in to comment.