Commit 7ef40fd1 authored by David Serduke's avatar David Serduke

Fixed #2076 where .val() could return an array instead of undefined when the...

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.
parent fc51e14b
...@@ -419,6 +419,7 @@ jQuery.fn = jQuery.prototype = { ...@@ -419,6 +419,7 @@ jQuery.fn = jQuery.prototype = {
} }
return undefined;
} }
return this.each(function(){ return this.each(function(){
......
...@@ -1029,11 +1029,12 @@ test("$.extend(Object, Object)", function() { ...@@ -1029,11 +1029,12 @@ test("$.extend(Object, Object)", function() {
}); });
test("val()", function() { test("val()", function() {
expect(3); expect(4);
ok( $("#text1").val() == "Test", "Check for value of input element" ); ok( $("#text1").val() == "Test", "Check for value of input element" );
ok( !$("#text1").val() == "", "Check for value of input element" ); ok( !$("#text1").val() == "", "Check for value of input element" );
// ticket #1714 this caused a JS error in IE // ticket #1714 this caused a JS error in IE
ok( $("#first").val() == "", "Check a paragraph element to see if it has a value" ); ok( $("#first").val() == "", "Check a paragraph element to see if it has a value" );
ok( $([]).val() === undefined, "Check an empty jQuery object will return undefined from val" );
}); });
test("val(String)", function() { test("val(String)", function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment