[Pkg-javascript-commits] [less.js] 13/26: support pre ie10 and fix sauce asking for js status before script loaded

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:25:18 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag v2.1.0
in repository less.js.

commit 75426cb1d74a3b236a19d6e99ca16770186ff273
Author: Luke Page <luke.a.page at gmail.com>
Date:   Sun Nov 16 15:00:04 2014 +0000

    support pre ie10 and fix sauce asking for js status before script loaded
---
 test/browser/test-runner-template.tmpl | 38 +++++++++++++++++++++++++++-------
 1 file changed, 30 insertions(+), 8 deletions(-)

diff --git a/test/browser/test-runner-template.tmpl b/test/browser/test-runner-template.tmpl
index 44e2e21..e504a30 100644
--- a/test/browser/test-runner-template.tmpl
+++ b/test/browser/test-runner-template.tmpl
@@ -38,6 +38,28 @@
     <% }) %>
 
     <script>
+
+        function loadScript(url,callback){
+            var script = document.createElement('script');
+
+            if(document.documentMode === 8){
+                script.onreadystatechange = function(){
+                    if (script.readyState === 'loaded'){
+                        if (callback){callback()};
+                    };
+                };
+            } else {
+                script.onload = function(){
+                    if (callback){callback()};
+                };
+            };
+            script.src = url;
+            document.body.appendChild(script);
+        };
+
+
+        // allow sauce to query for the jasmine report
+        window.jasmine = { getJSReport: function() { } };
         setTimeout(function() {
             var jasmine = <% toArray([].concat(scripts.polyfills, scripts.jasmine, scripts.boot)) %>,
                 helpers = <% toArray(scripts.helpers) %>,
@@ -46,15 +68,15 @@
                 reporters = <% toArray([].concat(scripts.reporters)) %>,
                 allScripts = jasmine.concat(helpers).concat(vendor).concat(specs).concat(reporters);
 
-            for(var i = 0; i < allScripts.length; i++) {
-                var script = document.createElement("script");
-                script.src = allScripts[i];
-                script.async = false;
-                document.body.appendChild(script);
+            function addNextScript() {
+                if (allScripts.length) {
+                    var scriptSrc = allScripts.shift();
+                    loadScript(scriptSrc, addNextScript);
+                } else {
+                    window.onload();
+                }
             }
-            script.onload = function() {
-                window.onload();
-            };
+            addNextScript();
 
         },1000);
     </script>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git



More information about the Pkg-javascript-commits mailing list