Ejemplo n.º 1
0
        private static void ClearUnsafeHtmlNode(HtmlNode htmlNode)
        {
            var attributes = htmlNode.Attributes.Where(attribute => !StringHelper.Contains(ValidAttributes, attribute.Name));

            attributes.Each(attribute => htmlNode.Attributes.Remove(attribute));

            if (htmlNode.HasChildNodes)
            {
                htmlNode.ChildNodes.Each(childNode => ClearUnsafeHtmlNode(childNode));
            }
        }