Fixed Bug #43 regression bug in IE<=8.
Fixed Bug #36 about race conditions with `.wait(...)` callbacks.
Fixed Bug #38 about incorrect handling of array parameters to `.script(...)` calls.
Fixed Bug #35 affecting IE6 and IE7 regarding path handling.
This is a complete ground-up rewrite of LABjs. The API is backwards-compatible (except for a few configuration options being removed). Many bugs were fixed and several new features were added.
- `AllowDuplicates` now actually works across chains. This is very important for those who want to use multiple/nested $LAB chains as part of a shared-dependency loading mechanism.
- Chains are now fully resumable, meaning you can save the return value from the last call to a chained function, and then use that saved value later as the starting point to resume the chain from where it left off.
- Queueing is now built-in, with `queueScript`, `queueWait` and `runQueue` -- this important for those who want to build up the chain across multiple files or inline <script> elements (like in the CMS case), but want to defer starting the loading of the code starting until later (usually at the bottom of the page).
- LABjs now supports `noConflict` (for rolling back to a previous version/copy of $LAB on the page) and `sandbox` (for creating a new pristine sandboxed copy of the current $LAB)
- LABjs now relies on feature-testing for `async=false` and implicit/explicit "true preloading" (currently only IE, but in the spec process). Ugly/hacky "cache preloading" is now only used for "older webkit" (before March 2011 nightlies, etc), and even then, only for remote files.
- For XHR preloading (only used in "older webkit" for local files, by default), to support better debugability, "// @sourceURL=..." is appended to the end of the code, to map the XHR/injected code to a real file name. Currently, browsers only support this for eval() (not script injection, like LABjs uses). It is hoped that browsers will soon support this annotation for their developer-tools.
- Speaking of debugging, LABjs now supports a DEBUG mode (only if you use the source file, or if you use the LABjs-debug.min.js production file) *and* enable the "Debug" config option, which captures all the inner workings (and any errors in .wait() calls) to the browser's console.log, if present.
- LABjs now supports a "CacheBust" config option, which will attempt to make sure all loaded scripts are forcibly loaded new on each page refresh, by auto-appending a random number parameter to each URL. This is really only practical/advised for DEV environments, where you want to ensure that the code reloads every time. Doing so in production would be really bad for user performance.
- As part of LABjs' rewrite, the code style is now significantly improved in readability (most "minification" hacks have been removed), and it's also using more memory-savvy code, such as far fewer closures. As a result, LABjs should run leaner and faster, if only by a little bit. The goal is to get LABjs out of the way so your scripts load and run as fast as possible.
- "AppendTo", "UsePreloading", and "UseCachePreloading" options (as well as the per-script "allowDup" option1) were removed as they are no longer useful. This is the only backwards-incompatible change (no actual API changes, just config), and the change should just cause older usage code to continue to operate as normal while ignoring the no longer supported options. Still, test your code carefully if you've been using either of those 3 config options before.
Browsers have long supported "protocol-relative URLs", which basically means leaving off the "http:" or "https:" portion of a URL (leaving just the "//domain.tld/path/..." part), which causes that URL to be assumed to be the same protocol as the parent page. The benefit is that if you have a page that can be viewed in either HTTP or HTTPS, and your resources can (and need to be) served through either HTTP or HTTPS, respectively, you can simply list your URLs as protocol-relative and the browser will auto-select based on which protocol the page is viewed in.
LABjs now supports specifying such URLs to any script URL setting. NOTE: This is the recommended way to specify URLs for script resources if: a) the page you're serving can be viewed in both HTTP and HTTPS; and b) the script resource you're linking to can be accessed using the exact same domain/path with exception to the protocol.
A common example of such a resource is the CDN locations on the Google Ajax API, where popular frameworks like jQuery and Dojo are hosted. If you are linking to such CDN resources, you are strongly encouraged to change to using protocol-relative URLs, like "//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" instead of "http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" or "https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js".
Fixed a minor (but long standing) bug around sections of the $LAB chain that are "empty" (that is, have nothing to load) not properly forwarding on the loading/execution cursor to the next section of the chain. This also corrects a failure in the previously released (in v1.1.11) functionality of conditional chaining with no-op functions in .script() calls.
Adding one new feature: the ability to pass a function to a .script() call. If a function is found as one of the parameters evaluated by .script(), that function will be immediately executed, and the value that it returns will be used as the value for that parameter. This allows you to specify "conditional chains" where you use run-time conditional logic to decide which script should be loaded. See the Documentation for more information.
These versions of LABjs were ghost versions that never saw the light of day. Or I just skipped them. I can't remember which.
LABjs is broken in FF 4b7 related to changes in dynamic script execution ordering behavior. The new (informal) proposal to the W3C is to support `async=false` functionality, which FF 4b8pre took the lead in implementing. So this release implements a feature test for `async=false` and uses it.
Fixed a bug where LABjs wasn't working in FF4 because of the removal of __count__ property which LABjs used as a Gecko inference. Also, cleaned up some code.
A number of tweaks and minor bug fixes. No more use of "rel" attributes on preload script tags. Changed the mimetype for preload script tags to "script/cache" (from "text/html"). Uses "insertBefore()" when adding scripts to the <head> to avoid possible bugs in IE6. Also, fixes use of live node lists to prevent bugs with IE where the list is invalidated after the DOM is changed.
You knew there had to be an obligatory, right-after-release, oops-crap-i-just-found-a-bug, patch. This is that patch. Fixes a corner case error where if you happen to end your chain with just a script() statement and no wait() statement, the end of the chain is never detected (which causes the final script to never execute!).
Final production release. 4.5k minified, 2.1k gzip'd. Have fun!
More optimizations for file-size. Also, changed XHR monitoring from setInterval() polling to a "onreadystatechange" handler.
Added a "hack" suggested by Andrea Giammarchi and adapted from: http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html NOTE: this hack only operates in FF and then only in versions where document.readyState is not present (FF < 3.6?).
The hack essentially "patches" the page that LABjs is loaded onto so that it has a proper conforming document.readyState, so that if a script which does proper and safe dom-ready detection is loaded onto a page, after dom-ready has passed, it will still be able to detect this state, by inspecting the now hacked document.readyState property. The loaded script in question can then immediately trigger any queued code executions that were waiting for the DOM to be ready. For instance, jQuery > 1.3.2 has been patched to take advantage of document.readyState, which is enabled by this hack. But 1.3.2 and before are **not** safe or affected by this hack, and should therefore **not** be lazy-loaded by script loader tools such as LABjs.
More tweaks to reduce file-size and improve performance. Also, fLABjs is now included, which is a special API wrapper for usage of LABjs in file:// local filesystem environments. Source on github here.
Tweaks for performance, changes to browser sniffing "hacks".
Huge reworking, adding the new "preloading" feature, new API. Documentation Coming Soon!
Further improvements to code, including smaller size (2.1k now!), and more efficient run-time execution.