Skip to content

Commit

Permalink
Merge pull request #296 from apetrushin/master
Browse files Browse the repository at this point in the history
Unblocking CSS #273
  • Loading branch information
unscriptable committed Jan 19, 2016
2 parents 4c08223 + d6f379e commit 40cfa8d
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions src/curl/plugin/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@
// only executes once (link.onload is acting as a flag)
if (isFinalized(link)) return;
finalize(link);
waitForDocumentComplete(function () { cb(link.sheet); });
cb(link.sheet);
}
// always try standard handler
loadHandler(link, load);
Expand Down Expand Up @@ -468,30 +468,6 @@
head.appendChild(link);
}

/**
* Keep checking for the document readyState to be "complete" since
* Chrome doesn't apply the styles to the document until that time.
* If we return before readyState == 'complete', Chrome may not have
* applied the styles, yet.
* Chrome only.
* @private
* @param cb
*/
function waitForDocumentComplete (cb) {
// this isn't exactly the same as domReady (when dom can be
// manipulated). it's later (when styles are applied).
// chrome needs this (and opera?)
function complete () {
if (isDocumentComplete()) {
cb();
}
else {
setTimeout(complete, 10);
}
}
complete();
}

/**
* Returns true if the documents' readyState == 'complete' or the
* document doesn't implement readyState.
Expand Down

0 comments on commit 40cfa8d

Please sign in to comment.