aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2009-02-18 19:43:14 +0000
committerJohn Resig <jeresig@gmail.com>2009-02-18 19:43:14 +0000
commitca79d866fe07302f03df2b3db09c886c6abef9ff (patch)
tree864d02768e01dfae54ea089db33485afca3f4a6a
parent75a973da35d4ad6583ebef8c389cebbef61bc5b4 (diff)
downloadjquery-ca79d866fe07302f03df2b3db09c886c6abef9ff.tar.gz
jquery-ca79d866fe07302f03df2b3db09c886c6abef9ff.zip
Made it so that search input elements are now serialized. Fixes bug #4107.
-rw-r--r--src/ajax.js2
-rw-r--r--test/index.html1
-rw-r--r--test/unit/ajax.js8
-rw-r--r--test/unit/selector.js6
4 files changed, 9 insertions, 8 deletions
diff --git a/src/ajax.js b/src/ajax.js
index 91043dedd..0f5f80529 100644
--- a/src/ajax.js
+++ b/src/ajax.js
@@ -71,7 +71,7 @@ jQuery.fn.extend({
.filter(function(){
return this.name && !this.disabled &&
(this.checked || /select|textarea/i.test(this.nodeName) ||
- /text|hidden|password/i.test(this.type));
+ /text|hidden|password|search/i.test(this.type));
})
.map(function(i, elem){
var val = jQuery(this).val();
diff --git a/test/index.html b/test/index.html
index ffc76aff5..4c47d92a5 100644
--- a/test/index.html
+++ b/test/index.html
@@ -68,6 +68,7 @@
<input type="text" style="display:none;" name="foo[bar]" id="hidden2"/>
<input type="text" id="name" name="name" value="name" />
+ <input type="search" id="search" name="search" value="search" />
<button id="button" name="button">Button</button>
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index a334f0d3e..0d2f071d9 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -186,11 +186,11 @@ test("serialize()", function() {
expect(6);
equals( jQuery('#form').serialize(),
- "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2",
+ "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&select1=&select2=3&select3=1&select3=2",
'Check form serialization as query string');
equals( jQuery('#form :input').serialize(),
- "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2",
+ "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&select1=&select2=3&select3=1&select3=2",
'Check input serialization as query string');
equals( jQuery('#testForm').serialize(),
@@ -202,11 +202,11 @@ test("serialize()", function() {
'Check input serialization as query string');
equals( jQuery('#form, #testForm').serialize(),
- "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
+ "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&select1=&select2=3&select3=1&select3=2&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
'Multiple form serialization as query string');
equals( jQuery('#form, #testForm :input').serialize(),
- "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&select1=&select2=3&select3=1&select3=2&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
+ "action=Test&radio2=on&check=on&hidden=&foo%5Bbar%5D=&name=name&search=search&select1=&select2=3&select3=1&select3=2&T3=%3F%0AZ&H1=x&H2=&PWD=&T1=&T2=YES&My+Name=me&S1=abc&S3=YES&S4=",
'Mixed form/input serialization as query string');
});
diff --git a/test/unit/selector.js b/test/unit/selector.js
index 425ad8c83..148151d5b 100644
--- a/test/unit/selector.js
+++ b/test/unit/selector.js
@@ -316,7 +316,7 @@ test("pseudo (:) selectors", function() {
t( "Last Child", "p:last-child", ["sap"] );
t( "Only Child", "a:only-child", ["simon1","anchor1","yahoo","anchor2","liveLink1","liveLink2"] );
t( "Empty", "ul:empty", ["firstUL"] );
- t( "Enabled UI Element", "#form input:not([type=hidden]):enabled", ["text1","radio1","radio2","check1","check2","hidden2","name"] );
+ t( "Enabled UI Element", "#form input:not([type=hidden]):enabled", ["text1","radio1","radio2","check1","check2","hidden2","name","search"] );
t( "Disabled UI Element", "#form input:disabled", ["text2"] );
t( "Checked UI Element", "#form input:checked", ["radio2","check1"] );
t( "Selected Option Element", "#form option:selected", ["option1a","option2d","option3b","option3c"] );
@@ -359,7 +359,7 @@ test("pseudo (:) selectors", function() {
t( "Is A Parent", "p:parent", ["firstp","ap","sndp","en","sap","first"] );
t( "Is Visible", "#form input:visible", [] );
t( "Is Visible", "div:visible:not(.testrunner-toolbar):lt(2)", ["nothiddendiv", "nothiddendivchild"] );
- t( "Is Hidden", "#form input:hidden", ["text1","text2","radio1","radio2","check1","check2","hidden1","hidden2","name"] );
+ t( "Is Hidden", "#form input:hidden", ["text1","text2","radio1","radio2","check1","check2","hidden1","hidden2","name","search"] );
t( "Is Hidden", "#main:hidden", ["main"] );
t( "Is Hidden", "#dl:hidden", ["dl"] );
@@ -382,7 +382,7 @@ test("pseudo (:) selectors", function() {
t( "Check element position", "#dl div:first > div:first", ["foo"] );
t( "Check element position", "div#nothiddendiv:first > div:first", ["nothiddendivchild"] );
- t( "Form element :input", "#form :input", ["text1", "text2", "radio1", "radio2", "check1", "check2", "hidden1", "hidden2", "name", "button", "area1", "select1", "select2", "select3"] );
+ t( "Form element :input", "#form :input", ["text1", "text2", "radio1", "radio2", "check1", "check2", "hidden1", "hidden2", "name", "search", "button", "area1", "select1", "select2", "select3"] );
t( "Form element :radio", "#form :radio", ["radio1", "radio2"] );
t( "Form element :checkbox", "#form :checkbox", ["check1", "check2"] );
t( "Form element :text", "#form :text", ["text1", "text2", "hidden2", "name"] );