From 3cdaebadeeb7f024a50fed485fb23455eef6412f Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 15 Feb 2013 18:01:28 +0530 Subject: [PATCH] Ox.sanitizeHTML: add replaceTags option --- source/Ox/js/HTML.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/Ox/js/HTML.js b/source/Ox/js/HTML.js index 81eeefb9..c32670b4 100644 --- a/source/Ox/js/HTML.js +++ b/source/Ox/js/HTML.js @@ -40,7 +40,7 @@ img: [ [ /]*?src="((\/|https?:\/\/).+?)".*?>/gi, - '' + '' ] ], rtl: [ @@ -499,9 +499,10 @@ > Ox.sanitizeHTML('') '<http://foo.com>' @*/ - Ox.sanitizeHTML = function(html, tags) { + Ox.sanitizeHTML = function(html, tags, replaceTags) { var matches = []; tags = tags || defaultTags; + replaceTags = replaceTags || {}; // html = Ox.clean(html); fixme: can this be a parameter? if (tags.indexOf('[]') > -1) { html = html.replace( @@ -513,7 +514,7 @@ }); } tags.forEach(function(tag) { - var array = replace[tag] || replace['*'](tag); + 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));