form-serialize
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -20,2 +20,3 @@ // get successful control from form and assemble into object | ||
// hash and url encoded str serializers are provided with this module | ||
// - disabled: [true | false]. If true serialize disabled fields. | ||
function serialize(form, options) { | ||
@@ -38,3 +39,3 @@ if (typeof options != 'object') { | ||
// ingore disabled fields | ||
if (element.disabled || !element.name) { | ||
if ((!options.disabled && element.disabled) || !element.name) { | ||
continue; | ||
@@ -41,0 +42,0 @@ } |
{ | ||
"name": "form-serialize", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "serialize html forms", | ||
@@ -10,8 +10,7 @@ "main": "index.js", | ||
"devDependencies": { | ||
"mocha": "~1.13.0", | ||
"domify": "~1.0.0", | ||
"zuul": "~0.2.1" | ||
"zuul": "~1.0.4" | ||
}, | ||
"scripts": { | ||
"test": "zuul --ui tdd test/*.js" | ||
"test": "zuul -- test/index.js" | ||
}, | ||
@@ -30,13 +29,3 @@ "repository": { | ||
"url": "https://github.com/shtylman/form-serialize/issues" | ||
}, | ||
"testling": { | ||
"harness": "mocha-tdd", | ||
"files": "test/*.js", | ||
"browsers": [ | ||
"ie/9..latest", | ||
"chrome/20..latest", | ||
"firefox/4..latest", | ||
"safari/5.0..latest" | ||
] | ||
} | ||
} |
@@ -1,5 +0,3 @@ | ||
# form-serialize | ||
# form-serialize [![Build Status](https://travis-ci.org/defunctzombie/form-serialize.png?branch=master)](https://travis-ci.org/defunctzombie/form-serialize) | ||
[![badge](https://ci.testling.com/shtylman/form-serialize.png)](https://ci.testling.com/shtylman/form-serialize) | ||
serialize form fields to submit a form over ajax | ||
@@ -32,3 +30,3 @@ | ||
var obj = serialiez(form, { hash: true }); | ||
var obj = serialize(form, { hash: true }); | ||
// obj -> { foo: 'bar' } | ||
@@ -50,6 +48,7 @@ ``` | ||
option | type | desc | ||
:--- | :--- | :--- | ||
hash | boolean | if true, the default hash serializer will be used | ||
serializer | function | provide a custom serializer | ||
option | type | default | desc | ||
:--- | :--- | :---: | :--- | ||
hash | boolean | false | if `true`, the hash serializer will be used for `serializer` option | ||
serializer | function | url-encoding | override the default serializer (hash or url-encoding) | ||
disabled | boolean | false | if `true`, disabled fields will also be serialized | ||
@@ -56,0 +55,0 @@ ### custom serializer |
@@ -14,2 +14,6 @@ var assert = require('assert'); | ||
var disabled_check = function(form, exp) { | ||
assert.deepEqual(serialize(form, { hash : false, disabled: true }), exp); | ||
}; | ||
test('nothing', function() { | ||
@@ -50,3 +54,3 @@ var form = domify('<form></form>'); | ||
test('ignore disabled', function() { | ||
test('handle disabled', function() { | ||
var form = domify('<form>' + | ||
@@ -60,2 +64,3 @@ '<input type="text" name="foo" value="bar 1"/>' + | ||
str_check(form, 'foo=bar+1'); | ||
disabled_check(form, 'foo=bar+1&foo.bar=bar+2'); | ||
}); | ||
@@ -62,0 +67,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12691
2
9
231
72