Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Fix a Gecko CSS loading bug in the minified JS caused by an unwanted …
Browse files Browse the repository at this point in the history
…Closure Compiler optimization. [Allex Wang]
  • Loading branch information
rgrove committed Jul 5, 2011
1 parent a2e9573 commit fb63205
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
5 changes: 4 additions & 1 deletion HISTORY
@@ -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
Expand Down
8 changes: 4 additions & 4 deletions lazyload-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions lazyload.js
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit fb63205

Please sign in to comment.