Skip to content

Commit

Permalink
feat: support async attribute dom ordering (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford authored Nov 5, 2021
1 parent 77020fd commit f83ba68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"test": "npm run test:test-base-href && npm run test:test-csp && npm run test:test-early-module-load && npm run test:test-polyfill && npm run test:test-polyfill-wasm && npm run test:test-preload-case && npm run test:test-revoke-blob-urls && npm run test:test-shim",
"test:test-base-href": "cross-env TEST_NAME=test-base-href node test/server.mjs",
"test:test-csp": "cross-env TEST_NAME=test-csp node test/server.mjs",
"test:test-dom-order": "cross-env TEST_NAME=test-dom-order node test/server.mjs",
"test:test-early-module-load": "cross-env TEST_NAME=test-early-module-load node test/server.mjs",
"test:test-polyfill": "cross-env TEST_NAME=test-polyfill node test/server.mjs",
"test:test-polyfill-wasm": "cross-env TEST_NAME=test-polyfill-wasm node test/server.mjs",
Expand Down
5 changes: 3 additions & 2 deletions src/es-module-shims.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,12 @@ function processScript (script) {
const isDomContentLoadedScript = domContentLoadedCnt > 0;
if (isReadyScript) readyStateCompleteCnt++;
if (isDomContentLoadedScript) domContentLoadedCnt++;
const loadPromise = topLevelLoad(script.src || `${pageBaseUrl}?${id++}`, getFetchOpts(script), !script.src && script.innerHTML, !shimMode, isReadyScript && lastStaticLoadPromise).catch(e => {
const blocks = script.getAttribute('async') === null && isReadyScript;
const loadPromise = topLevelLoad(script.src || `${pageBaseUrl}?${id++}`, getFetchOpts(script), !script.src && script.innerHTML, !shimMode, blocks && lastStaticLoadPromise).catch(e => {
setTimeout(() => { throw e });
onerror(e);
});
if (isReadyScript)
if (blocks)
lastStaticLoadPromise = loadPromise.then(readyStateCompleteCheck);
if (isDomContentLoadedScript)
loadPromise.then(domContentLoadedCheck);
Expand Down

0 comments on commit f83ba68

Please sign in to comment.