jQuery: The Write Less, Do More JavaScript Library

Changeset 4220

Show
Ignore:
Timestamp:
12/18/07 17:19:33 (8 months ago)
Author:
davidserduke
Message:

Fixed #2076 where .val() could return an array instead of undefined when the jquery object was empty. The bug was created during the .val() refactoring for the javascript strict FF ticket.

Location:
trunk/jquery
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/jquery/src/core.js

    r4217 r4220  
    420420            } 
    421421 
     422            return undefined; 
    422423        } 
    423424 
  • trunk/jquery/test/unit/core.js

    r4217 r4220  
    10301030 
    10311031test("val()", function() { 
    1032     expect(3); 
     1032    expect(4); 
    10331033    ok( $("#text1").val() == "Test", "Check for value of input element" ); 
    10341034    ok( !$("#text1").val() == "", "Check for value of input element" ); 
    10351035    // ticket #1714 this caused a JS error in IE 
    10361036    ok( $("#first").val() == "", "Check a paragraph element to see if it has a value" ); 
     1037    ok( $([]).val() === undefined, "Check an empty jQuery object will return undefined from val" ); 
    10371038}); 
    10381039