Skip to content

Conversation

@jtrumbull
Copy link
Contributor

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @jaubourg, @timmywil and @markelog to be potential reviewers

@jquerybot
Copy link

Thank you for your pull request. It looks like this may be your first contribution to a jQuery Foundation project, if so we need you to sign our Contributor License Agreement (CLA).

📝 Please visit http://contribute.jquery.org/CLA/ to sign.

After you signed, the PR is checked again automatically after a minute. If there's still an issue, please reply here to let us know.


If you've already signed our CLA, it's possible your git author information doesn't match your CLA signature (both your name and email have to match), for more information, check the status of your CLA check.

@mgol
Copy link
Member

mgol commented Mar 17, 2016

@jtrumbull Thanks for the PR! This will need unit tests to prove that this PR fixes the linked issue. Tests for this module are located in https://github.com/jquery/jquery/blob/master/test/unit/serialize.js.

@jtrumbull
Copy link
Contributor Author

@mgol Full test suite is passing.

params = { "test": [ 1, 2, null ] };
assert.equal( jQuery.param( params, false ), "test%5B%5D=1&test%5B%5D=2&test%5B%5D=", "object with array property with null value" );

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert the change in this line. We disallow trailing spaces.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This applies to a few other changed lines as well.

@jtrumbull
Copy link
Contributor Author

@mgol I fixed the whitepace issue. However, this made me curious as to why an error wasn't being thrown by jscs. After looking at the gruntfile, I noticed that it's because only parts of the test directory are being run through. More out of curiosity than anything, do you happen to know why this is?

@mgol
Copy link
Member

mgol commented Mar 17, 2016

Ideally we'd check every file but those test files are very old, they contain lots of errors so fixing them is not an easy task... We're enabling JSCS file by file but we've got a long way ahead to lint everything.

Source is linted completely, though, only tests are lacking.

src/serialize.js Outdated
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
value = jQuery.isFunction( value ) ? value() : value;
value = value == null ? "" : value;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be smaller as if ( value == null ).

@timmywil timmywil changed the title Fix: Issue # 3005 Serialize: set empty string if value function returns null Mar 21, 2016
assert.equal( jQuery.param( params, false ), "param1=", "Make sure that null params aren't traversed." );

params = { "param1": function() {}, "param2": function() { return null; } };
assert.equal( jQuery.param( params, false ), "param1=&param2=", "object with method properties return null" );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

object with method properties return null -> Object with method properties that return null

I.e. start with a capital letter and fix one grammar issue in this sentence (as I understand it).

@mgol
Copy link
Member

mgol commented Apr 4, 2016

LGTM.

@gibson042 gibson042 closed this in 9fdbdd3 Apr 5, 2016
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants