Scott Koon avatar Scott Koon committed 9165174

A test caught a problem when assigning an id to a script.

Comments (0)

Files changed (2)

         }
 
         var head = document.head || document.getElementsByTagName("head")[0];
-        var scriptId = (function() { if(args.length==2) { return args[1];} else {return false;}})() || "script" + Math.floor(Math.random() * 1234);
+        var scriptId = args[1] || "script" + Math.floor(Math.random() * 1234);
         var loaded = false;
         var scriptTag = null;
-        var callback = null;
-        if(args.length == 3) callback = args[2];
+        var callback = callback = args[2] || null;
 
         function notLoaded(src, type) {
             var nodeList;
 
 testSuite.add(function() {
     var scripts = document.getElementsByTagName("script");
-    return (scripts.length==3);
+    return (scripts.length==5);
 }
-        , "Are all 4 scripts loaded?"
-        , "All 4 scripts are not loaded.")
+        , "Are all 5 scripts loaded?"
+        , "All 5 scripts are not loaded.")
 testSuite.add(function() {
     return ( document.getElementById("test") != null )
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.