Skip to content

Commit

Permalink
Calling validate on a long form on IE7 will cause the "Script is taki…
Browse files Browse the repository at this point in the history
…ng too long" to display after sometime. This is tested with jQuery 1.4.4 and Validation Plugin 1.8.1

When investigating the library itself the problem turned to be that this line is causing the slowness: this.find("input, button").
The code modifications make the caches the jQuery object rather than querying again, thus, saving valuable resources.
  • Loading branch information
AdamTibi authored and jzaefferer committed Sep 5, 2011
1 parent 47cbaa2 commit d3f9b46
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jquery.validate.js
Expand Up @@ -37,14 +37,16 @@ $.extend($.fn, {

if ( validator.settings.onsubmit ) {

var inputsAndButtons = this.find("input, button");

// allow suppresing validation by adding a cancel class to the submit button
this.find("input, button").filter(".cancel").click(function() {
inputsAndButtons.filter(".cancel").click(function () {
validator.cancelSubmit = true;
});

// when a submitHandler is used, capture the submitting button
if (validator.settings.submitHandler) {
this.find("input, button").filter(":submit").click(function() {
inputsAndButtons.filter(":submit").click(function () {
validator.submitButton = this;
});
}
Expand Down

0 comments on commit d3f9b46

Please sign in to comment.