Skip to content

Commit

Permalink
FIXED slugfy and serialize methods from String module
Browse files Browse the repository at this point in the history
- Slugfy was checking for the wrong variable (before removing the trailing slash)
- In modern browsers, objects carry the default parameter "classList". Now it is removed from the serialized string.
  • Loading branch information
Jo Santana committed Jan 6, 2016
1 parent e80f50f commit e1ae16e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion source/string/serialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ exports.serialize = function (obj) {
var data = '';

for (var key in obj) {
data += key + '=' + encodeURIComponent(obj[key]) + '&';
if (key !== 'classList') {
data += key + '=' + encodeURIComponent(obj[key]) + '&';
}
}

data = data.slice(0,-1);
Expand Down
2 changes: 1 addition & 1 deletion source/string/slugfy.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ exports.slugfy = function (string) {

// Remove trailing dash

if (root._.endsWith(string, '-')) {
if (root._.endsWith(slug, '-')) {
slug = slug.slice(0, slug.length - 1);
}

Expand Down

0 comments on commit e1ae16e

Please sign in to comment.