Skip to content

Instantly share code, notes, and snippets.

@Noitidart
Last active July 25, 2016 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Noitidart/6c172e77fe48f78521f2 to your computer and use it in GitHub Desktop.
Save Noitidart/6c172e77fe48f78521f2 to your computer and use it in GitHub Desktop.
_ff-addon-snippet-jqLike - Port jQuery functions as standalone for use in my addons
var jQLike = { // my stand alone jquery like functions
serialize: function(aSerializeObject, aEncoder=encodeURIComponent) {
// https://api.jquery.com/serialize/
// verified this by testing
// http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_ajax_serialize
// http://www.the-art-of-web.com/javascript/escape/
var serializedStrArr = [];
for (var cSerializeKey in aSerializeObject) {
serializedStrArr.push(aEncoder(cSerializeKey) + '=' + aEncoder(aSerializeObject[cSerializeKey]));
}
return serializedStrArr.join('&');
}
};
@Noitidart
Copy link
Author

Noitidart commented Jan 13, 2016

README

Rev1

  • jquery serialize

Rev2

  • gave the serialize function 2nd arg so can use custom encoder, like for twitter we need to_rfc3986

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment