/* HTML Clean for jQuery Anthony Johnston http://www.antix.co.uk version 1.3.1 $Revision$ requires jQuery http://jquery.com Use and distibution http://www.opensource.org/licenses/bsd-license.php 2010-04-02 allowedTags/removeTags added (white/black list) thanks to David Wartian (Dwartian) 2010-06-30 replaceStyles added for replacement of bold, italic, super and sub styles on a tag 2012-04-30 allowedAttributes added, an array of attributed allowed on the elements 2013-02-25 now will push non-inline elements up the stack if nested in an inline element 2013-02-25 comment element support added, removed by default, see AllowComments in options */ (function ($) { $.fn.htmlClean = function (options) { // iterate and html clean each matched element return this.each(function () { var $this = $(this); if (this.value) { this.value = $.htmlClean(this.value, options); } else { this.innerHTML = $.htmlClean(this.innerHTML, options); } }); }; // clean the passed html $.htmlClean = function (html, options) { options = $.extend({}, $.htmlClean.defaults, options); var tagsRE = /(<(\/)?(\w+:)?([\w]+)([^>]*)>)|