AjaxControlToolkit.HtmlEditor.Sanitizer.DefaultHtmlSanitizer.CleanAttributes C# (CSharp) Method

CleanAttributes() static private method

static private CleanAttributes ( IEnumerable attributes, ICollection allowedAttributes ) : void
attributes IEnumerable
allowedAttributes ICollection
return void
        static void CleanAttributes(IEnumerable<IHtmlAttribute> attributes, ICollection<string> allowedAttributes)
        {
            var attributesToBeRemoved = new List<IHtmlAttribute>();

            foreach(var attribute in attributes) {
                if(allowedAttributes.Contains(attribute.Name))
                    CleanAttributeValue(attribute);
                else
                    attributesToBeRemoved.Add(attribute);
            }

            foreach(var attribute in attributesToBeRemoved)
                attribute.Remove();
        }