Skip to content

Commit

Permalink
[data-ajax-off] supports plain comma or space as separator [closes vo…
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtech-dobes committed Jul 7, 2013
1 parent 9a5e626 commit 65bc103
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion nette.ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,22 @@ var nette = function () {
}

if ($el.is('[data-ajax-off]')) {
settings.off = $el.data('ajaxOff');
var rawOff = $el.attr('data-ajax-off');
if (rawOff.indexOf('[') === 0) {
settings.off = $el.data('ajaxOff');
} else if (rawOff.indexOf(',') !== -1) {
settings.off = rawOff.split(',');
} else if (rawOff.indexOf(' ') !== -1) {
settings.off = rawOff.split(' ');
} else {
settings.off = rawOff;
}
if (typeof settings.off === 'string') settings.off = [settings.off];
settings.off = $.grep($.each(settings.off, function (off) {
return $.trim(off);
}), function (off) {
return off.length;
});
}
}

Expand Down

0 comments on commit 65bc103

Please sign in to comment.