jQuery: The Write Less, Do More JavaScript Library

Changeset 4547

Show
Ignore:
Timestamp:
01/28/08 18:49:04 (7 months ago)
Author:
joern.zaefferer
Message:

Fix for #2216

Location:
trunk/plugins/validate
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/plugins/validate/jquery.validate.js

    r4535 r4547  
    1717    // http://docs.jquery.com/Plugins/Validation/validate 
    1818    validate: function( options ) { 
     19         
     20        // if nothing is selected, return nothing; can't chain anyway 
     21        if (!this.length) { 
     22            options && options.debug && window.console && console.warn( "nothing selected, can't validate, returning nothing" ); 
     23            return; 
     24        } 
    1925         
    2026        // check if a validator for this form was already created 
  • trunk/plugins/validate/test/test.js

    r4540 r4547  
    88    equals( v1, v2, "Calling validate() multiple times must return the same validator instance" ); 
    99    equals( 2, v1.elements().length, "validator must have two elements" ); 
     10}); 
     11 
     12test("validate() without elements, with non-form elements", function() { 
     13    $("#doesn'texist").validate(); 
    1014}); 
    1115