Skip to content

Commit d598274

Browse files
committed
Enable bootstrap method being called AFTER DOM has loaded.
Update build tools, publish new version.
1 parent ec646ce commit d598274

File tree

6 files changed

+293
-252
lines changed

6 files changed

+293
-252
lines changed

dist/aspnet-validation.js

Lines changed: 13 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/aspnet-validation.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/aspnet-validation.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aspnet-validation",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"description": "Enables ASP.NET MVC client-side validation, without jQuery!",
55
"main": "dist/aspnet-validation.js",
66
"style": "dist/aspnet-validation.css",
@@ -16,10 +16,10 @@
1616
"build": "webpack && webpack --config webpack.config.min.js"
1717
},
1818
"devDependencies": {
19-
"ts-loader": "^4.4.1",
20-
"typescript": "^2.9.2",
21-
"webpack": "^4.12.0",
22-
"webpack-cli": "^3.0.6"
19+
"ts-loader": "^4.5.0",
20+
"typescript": "^3.0.1",
21+
"webpack": "^4.17.1",
22+
"webpack-cli": "^3.1.0"
2323
},
2424
"dependencies": {}
2525
}

src/index.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -840,9 +840,17 @@ export class ValidationService {
840840
bootstrap() {
841841
this.addMvcProviders();
842842

843-
document.addEventListener('DOMContentLoaded', event => {
843+
if (document.readyState === 'loading') {
844+
document.addEventListener('DOMContentLoaded', event => {
845+
this.scanMessages();
846+
this.scanInputs();
847+
});
848+
} else {
849+
// interactive: The document has finished loading and the document has been parsed
850+
// but sub-resources such as images, stylesheets and frames are still loading.
851+
// or complete: The document and all sub-resources have finished loading.
844852
this.scanMessages();
845853
this.scanInputs();
846-
});
854+
}
847855
}
848856
}

0 commit comments

Comments
 (0)