Package com.attribyte.parser
Class Safelists
java.lang.Object
com.attribyte.parser.Safelists
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.google.common.collect.ImmutableSet<String> An immutable set of the names of all HTML 5 block elements.static final com.google.common.collect.ImmutableSet<String> An immutable set of HTML 'event' attribute names.static final com.google.common.collect.ImmutableSet<String> All HTML 5 inline element names.static final com.google.common.collect.ImmutableSet<String> An immutable set of the names of all HTML 5 inline elements that are "safe" (excludesobjectandscript). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.jsoup.safety.SafelistThe basic safelist.static org.jsoup.safety.SafelistA safelist that includes only HTML5 block elements withclass,idanddata-*attributes.static org.jsoup.safety.SafelistThe default content safelist.static org.jsoup.safety.SafelistThe default content safelist with images allowed.static org.jsoup.safety.Safelistsafelist(Collection<String> allowTags, Collection<String> allowAttributes) Creates a safelist that allows a specific set of tags and attributes (without regard to context).
-
Field Details
-
blockElementNames
An immutable set of the names of all HTML 5 block elements. -
inlineElementNames
All HTML 5 inline element names. -
safeInlineElementNames
An immutable set of the names of all HTML 5 inline elements that are "safe" (excludesobjectandscript). -
eventAttributeNames
An immutable set of HTML 'event' attribute names.
-
-
Constructor Details
-
Safelists
public Safelists()
-
-
Method Details
-
contentSafelistWithImages
public static org.jsoup.safety.Safelist contentSafelistWithImages()The default content safelist with images allowed.- Returns:
- The content safelist.
-
contentSafelist
public static org.jsoup.safety.Safelist contentSafelist()The default content safelist.Includes tags from the basic safelist as well as
h1, h2, h3, h4, h5, h6, table, tr, td, th, tbody, tfoot, thead, col, colgroup, figure, figcaption header, footer, aside, details, section, summary, time, article, main- Returns:
- The safelist.
-
safelist
public static org.jsoup.safety.Safelist safelist(Collection<String> allowTags, Collection<String> allowAttributes) Creates a safelist that allows a specific set of tags and attributes (without regard to context).- Parameters:
allowTags- A collection of tags to allow. Add'data-*'to allow any HTML5 data attribute.allowAttributes- A collection of attributes to allow.- Returns:
- The safelist.
-
blockElements
public static org.jsoup.safety.Safelist blockElements()A safelist that includes only HTML5 block elements withclass,idanddata-*attributes.- Returns:
- The safelist.
-
basicSafelist
public static org.jsoup.safety.Safelist basicSafelist()The basic safelist.Includes tags:
a, b, blockquote, br, cite, code, dd, dl, dt, em, i, li, ol, p, pre, q, small, strike, del, s, strong, sub, sup, u, ul, mark, bdi- Returns:
- The safelist.
-