mirror of
https://github.com/jquery-validation/jquery-validation.git
synced 2025-12-20 09:11:40 +01:00
Calling validate on a long form on IE7 will cause the "Script is taking 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.
This commit is contained in:
committed by
Jörn Zaefferer
parent
47cbaa24d6
commit
d3f9b4660a
6
jquery.validate.js
vendored
6
jquery.validate.js
vendored
@@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user