using AngleSharp.Css.Dom;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
namespace Ganss.Xss;
///
/// Default options.
///
public static class HtmlSanitizerDefaults
{
///
/// The default allowed CSS at-rules.
///
public static ISet AllowedAtRules { get; } = new HashSet()
{
CssRuleType.Style, CssRuleType.Namespace
}.ToImmutableHashSet();
///
/// The default allowed URI schemes.
///
public static ISet AllowedSchemes { get; } = new HashSet(StringComparer.OrdinalIgnoreCase)
{
"http", "https"
}.ToImmutableHashSet(StringComparer.OrdinalIgnoreCase);
///
/// The default allowed HTML tag names.
///
public static ISet AllowedTags { get; } = new HashSet(StringComparer.OrdinalIgnoreCase)
{
// https://developer.mozilla.org/en/docs/Web/Guide/HTML/HTML5/HTML5_element_list
"a", "abbr", "acronym", "address", "area", "b",
"big", "blockquote", "br", "button", "caption", "center", "cite",
"code", "col", "colgroup", "dd", "del", "dfn", "dir", "div", "dl", "dt",
"em", "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6",
"hr", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "map",
"menu", "ol", "optgroup", "option", "p", "pre", "q", "s", "samp",
"select", "small", "span", "strike", "strong", "sub", "sup", "table",
"tbody", "td", "textarea", "tfoot", "th", "thead", "tr", "tt", "u",
"ul", "var",
// HTML5
// Sections
"section", "nav", "article", "aside", "header", "footer", "main",
// Grouping content
"figure", "figcaption",
// Text-level semantics
"data", "time", "mark", "ruby", "rt", "rp", "bdi", "wbr",
// Forms
"datalist", "keygen", "output", "progress", "meter",
// Interactive elements
"details", "summary", "menuitem",
// document elements
"html", "head", "body"
}.ToImmutableHashSet(StringComparer.OrdinalIgnoreCase);
///
/// The default allowed HTML attributes.
///
public static ISet AllowedAttributes { get; } = new HashSet(StringComparer.OrdinalIgnoreCase)
{
// https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
"abbr", "accept", "accept-charset", "accesskey",
"action", "align", "alt", "axis", "bgcolor", "border", "cellpadding",
"cellspacing", "char", "charoff", "charset", "checked", "cite", /* "class", */
"clear", "cols", "colspan", "color", "compact", "coords", "datetime",
"dir", "disabled", "enctype", "for", "frame", "headers", "height",
"href", "hreflang", "hspace", /* "id", */ "ismap", "label", "lang",
"longdesc", "maxlength", "media", "method", "multiple", "name",
"nohref", "noshade", "nowrap", "prompt", "readonly", "rel", "rev",
"rows", "rowspan", "rules", "scope", "selected", "shape", "size",
"span", "src", "start", "style", "summary", "tabindex", "target", "title",
"type", "usemap", "valign", "value", "vspace", "width",
// HTML5
"high", //
"keytype", //
"list", //
"low", //
"max", // , ,