Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fix a Gecko CSS loading bug in the minified JS caused by an unwanted …

…Closure Compiler optimization. [Allex Wang]
  • Loading branch information...
rgrove committed Jul 5, 2011
1 parent a2e9573 commit fb63205e20c76061f616150264670acac6877b3f
Showing with 15 additions and 7 deletions.
  1. +4 −1 HISTORY
  2. +4 −4 lazyload-min.js
  3. +7 −2 lazyload.js
@@ -1,7 +1,10 @@
LazyLoad Changelog
================================================================================

Version 2.0.3 (git)
Version 2.0.3 (2011-07-05)
* Fixed a bug caused by an unwanted Closure Compiler optimization that broke
CSS load completion detection in Gecko when using the minified version of
LazyLoad. [Allex Wang]
* Fixed a race condition in which a URL could be removed from the "pending"
queue if it finished loading before other URLs in the same batch had been
added to the queue, resulting in the queue's length changing unexpectedly

Some generated files are not rendered by default. Learn more.

@@ -277,8 +277,13 @@ LazyLoad = (function (doc) {
@private
*/
function pollGecko(node) {
var hasRules;

try {
node.sheet.cssRules;
// We don't really need to store this value or ever refer to it again, but
// if we don't store it, Closure Compiler assumes the code is useless and
// removes it.
hasRules = !!node.sheet.cssRules;
} catch (ex) {
// An exception means the stylesheet is still loading.
pollCount += 1;
@@ -289,7 +294,7 @@ LazyLoad = (function (doc) {
// We've been polling for 10 seconds and nothing's happened. Stop
// polling and finish the pending requests to avoid blocking further
// requests.
finish('css');
hasRules && finish('css');
}

return;

0 comments on commit fb63205

Please sign in to comment.
You can’t perform that action at this time.