in Ox.sanitizeHTML, when passing an array of replaceTags tuples, allow for the second element of that tuple to be a replace function (not just a string)

This commit is contained in:
rolux 2013-02-16 12:39:16 +05:30
parent 180b325e30
commit 5227dbc166

View file

@ -517,7 +517,13 @@
var array = replaceTags[tag] || replace[tag] || replace['*'](tag);
Ox.forEach(array, function(value) {
html = html.replace(value[0], function() {
matches.push(Ox.formatString(value[1], arguments));
var match;
if (Ox.isFunction(value[1])) {
match = value[1].apply(null, arguments);
} else {
match = Ox.formatString(value[1], arguments);
}
matches.push(match);
return salt.join(matches.length - 1);
});
});