kaijajan / swfobject

Automatically exported from code.google.com/p/swfobject
0 stars 0 forks source link

Try to avoid busy waiting when possible. #625

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. load swfobject.js before onload is fired.
2. notice busy waiting(setTimeout calls) until document is ready.

What is the expected output? What do you see instead?

No busy waiting.

What version of the product are you using? On what operating system?

2.2

Please provide any additional information below.

Newer version is better than past versions, but there could be more 
improvement. Here is a diff:

                if (!isDomLoaded) {
                        if (typeof doc.addEventListener != UNDEF) {
                                doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
+                               // No need to continue and possibly busy wait.
+                               return;
                        }
                        if (ua.ie && ua.win) {
                                doc.attachEvent(ON_READY_STATE_CHANGE, function() {
@@ -775,3 +777,186 @@ var swfobject = function() {
                }
        };
 }();

Original issue reported on code.google.com by belli...@google.com on 23 Mar 2012 at 8:08