scottschiller/SoundManager2 — pull request #42 by eml (2013-12-29 00:37:48+00:00)
Title: allow setup when DOM is in 'complete' _and_ 'interactive' state

We use SM2 internally with requirejs and also we bundle up SM2 with our own library that is loaded in a script tag. To keep initialization of SM2 consistent in the diff environments we use 'SM2_DEFER = true' and then create and 'setup' the SoundManager instance ourselves.

We ran into a problem when using the deferred setup and jQuery's document ready handler, where the 'ready' event is never called:

```

```

It seems that the document.readyState at that point in time we call 'setup()' is 'interactive', and not 'complete', so the code in 'setup()' that calls 'domContentLoaded()' doesn't get called. This patch changes the logic so that 'domContentLoaded()' will still be called when the page is in an 'interactive' but not yet 'complete' state.