Class Safelists

java.lang.Object
com.attribyte.parser.Safelists

public class Safelists extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static 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" (excludes object and script).
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.jsoup.safety.Safelist
    The basic safelist.
    static org.jsoup.safety.Safelist
    A safelist that includes only HTML5 block elements with class, id and data-*attributes.
    static org.jsoup.safety.Safelist
    The default content safelist.
    static org.jsoup.safety.Safelist
    The default content safelist with images allowed.
    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).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • blockElementNames

      public static final com.google.common.collect.ImmutableSet<String> blockElementNames
      An immutable set of the names of all HTML 5 block elements.
    • inlineElementNames

      public static final com.google.common.collect.ImmutableSet<String> inlineElementNames
      All HTML 5 inline element names.
    • safeInlineElementNames

      public static final com.google.common.collect.ImmutableSet<String> safeInlineElementNames
      An immutable set of the names of all HTML 5 inline elements that are "safe" (excludes object and script).
    • eventAttributeNames

      public static final com.google.common.collect.ImmutableSet<String> 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 with class, id and data-*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.