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

CleanNodes() static private method

static private CleanNodes ( IEnumerable nodes, string[]>.IDictionary whiteList ) : void
nodes IEnumerable
whiteList string[]>.IDictionary
return void
        static void CleanNodes(IEnumerable<IHtmlNode> nodes, IDictionary<string, string[]> whiteList)
        {
            var nodesToBeRemoved = new List<IHtmlNode>();

            foreach(var node in nodes) {
                if(whiteList.ContainsKey(node.Name)) {
                    CleanAttributes(node.Attributes, whiteList[node.Name]);
                    CleanNodes(node.Children, whiteList);
                } else {
                    nodesToBeRemoved.Add(node);
                }
            }

            foreach(var node in nodesToBeRemoved)
                node.Remove();
        }