Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(profile-w3c-common): smaller DOM ready #1277

Merged
merged 2 commits into from Jun 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions js/profile-w3c-common.js
Expand Up @@ -40,10 +40,15 @@ require.config({
deps: ["deps/hyperhtml", "deps/url-search-params"],
});

const domReady = new Promise(function(resolve){
return document.readyState === "complete"
? resolve()
: document.addEventListener("DOMContentLoaded", resolve);
});

define(
[
// order is significant
"deps/domReady",
"core/base-runner",
"core/ui",
"core/aria",
Expand Down Expand Up @@ -90,12 +95,12 @@ define(
/*Linter must be the last thing to run*/
"w3c/linter",
],
function(domReady, runner, ui) {
function(runner, ui) {
var args = Array.from(arguments).filter(function(item) {
return item;
});
ui.show();
domReady(function() {
domReady.then(function() {
runner
.runAll(args)
.then(document.respecIsReady)
Expand Down
1 change: 1 addition & 0 deletions karma.conf.js
Expand Up @@ -78,6 +78,7 @@ module.exports = function(config) {
"/js/deps/": "/base/js/deps/",
"/base/deps/": "/base/js/deps/",
"/base/deps/marked.js": "/base/js/deps/marked.js",
"/worker/respec-worker.js": "/base/worker/respec-worker.js"
},

// preprocess matching files before serving them to the browser
Expand Down