Commit 5c6c9936 authored by David Serduke's avatar David Serduke

Fixed #1714 by adding a default empty string if the value is falsey.

parent 0a755f6a
...@@ -396,7 +396,7 @@ jQuery.fn = jQuery.prototype = { ...@@ -396,7 +396,7 @@ jQuery.fn = jQuery.prototype = {
// Everything else, we just grab the value // Everything else, we just grab the value
} else } else
return this[0].value.replace(/\r/g, ""); return (this[0].value || "").replace(/\r/g, "");
} }
......
...@@ -881,9 +881,11 @@ test("$.extend(Object, Object)", function() { ...@@ -881,9 +881,11 @@ test("$.extend(Object, Object)", function() {
}); });
test("val()", function() { test("val()", function() {
expect(2); expect(3);
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
ok( $("#first").val() == "", "Check a paragraph element to see if it has a value" );
}); });
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