Package org.jsoup.safety

## Class Whitelist

- java.lang.Object
- - org.jsoup.safety.Safelist
  - - org.jsoup.safety.Whitelist

    @Deprecated
    public class Whitelist
    extends Safelist

Deprecated.
As of release `v1.14.1`, this class is deprecated in favour of `Safelist`. The name has been changed with the intent of promoting more inclusive language. `Safelist` is a drop-in replacement, and no further changes other than updating the name in your code are required to cleanly migrate. This class will be removed in `v1.15.1`. Until that release, this class acts as a shim to maintain code compatibility (source and binary).

For a clear rationale of the removal of this change, please see Terminology, Power, and Inclusive Language in Internet-Drafts and RFCs

### Constructor Summary

Constructors
`Whitelist()` Deprecated.
`Whitelist​(Safelist copy)` Deprecated.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
`Whitelist` `addAttributes​(java.lang.String tag, java.lang.String... attributes)` Deprecated. Add a list of allowed attributes to a tag.
`Whitelist` `addEnforcedAttribute​(java.lang.String tag, java.lang.String attribute, java.lang.String value)` Deprecated. Add an enforced attribute to a tag.
`Whitelist` `addProtocols​(java.lang.String tag, java.lang.String attribute, java.lang.String... protocols)` Deprecated. Add allowed URL protocols for an element's URL attribute.
`Whitelist` `addTags​(java.lang.String... tags)` Deprecated. Add a list of allowed elements to a safelist.
`static Whitelist` `basic()` Deprecated.
`static Whitelist` `basicWithImages()` Deprecated.
`protected boolean` `isSafeAttribute​(java.lang.String tagName, Element el, Attribute attr)` Deprecated. Test if the supplied attribute is allowed by this safelist for this tag
`protected boolean` `isSafeTag​(java.lang.String tag)` Deprecated. Test if the supplied tag is allowed by this safelist
`static Whitelist` `none()` Deprecated.
`Whitelist` `preserveRelativeLinks​(boolean preserve)` Deprecated. Configure this Safelist to preserve relative links in an element's URL attribute, or convert them to absolute links.
`static Whitelist` `relaxed()` Deprecated.
`Whitelist` `removeAttributes​(java.lang.String tag, java.lang.String... attributes)` Deprecated. Remove a list of allowed attributes from a tag.
`Whitelist` `removeEnforcedAttribute​(java.lang.String tag, java.lang.String attribute)` Deprecated. Remove a previously configured enforced attribute from a tag.
`Whitelist` `removeProtocols​(java.lang.String tag, java.lang.String attribute, java.lang.String... removeProtocols)` Deprecated. Remove allowed URL protocols for an element's URL attribute.
`Whitelist` `removeTags​(java.lang.String... tags)` Deprecated. Remove a list of allowed elements from a safelist.
`static Whitelist` `simpleText()` Deprecated.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### Whitelist

    public Whitelist()

Deprecated.

#### Whitelist

    public Whitelist​(Safelist copy)

Deprecated.

### Method Detail

#### basic

    public static Whitelist basic()

Deprecated.

#### basicWithImages

    public static Whitelist basicWithImages()

Deprecated.

#### none

    public static Whitelist none()

Deprecated.

#### relaxed

    public static Whitelist relaxed()

Deprecated.

#### simpleText

    public static Whitelist simpleText()

Deprecated.

#### addTags

    public Whitelist addTags​(java.lang.String... tags)

Deprecated.
Description copied from class: `Safelist`
Add a list of allowed elements to a safelist. (If a tag is not allowed, it will be removed from the HTML.)

Overrides:
  `addTags` in class `Safelist`
Parameters:
  `tags` - tag names to allow
Returns:
  this (for chaining)

#### removeTags

    public Whitelist removeTags​(java.lang.String... tags)

Deprecated.
Description copied from class: `Safelist`
Remove a list of allowed elements from a safelist. (If a tag is not allowed, it will be removed from the HTML.)

Overrides:
  `removeTags` in class `Safelist`
Parameters:
  `tags` - tag names to disallow
Returns:
  this (for chaining)

#### addAttributes

    public Whitelist addAttributes​(java.lang.String tag,
                                   java.lang.String... attributes)

Deprecated.
Description copied from class: `Safelist`
Add a list of allowed attributes to a tag. (If an attribute is not allowed on an element, it will be removed.)

E.g.: `addAttributes("a", "href", "class")` allows `href` and `class` attributes on `a` tags.

To make an attribute valid for all tags, use the pseudo tag `:all`, e.g. `addAttributes(":all", "class")`.

Overrides:
  `addAttributes` in class `Safelist`
Parameters:
  `tag` - The tag the attributes are for. The tag will be added to the allowed tag list if necessary.
  `attributes` - List of valid attributes for the tag
Returns:
  this (for chaining)

#### removeAttributes

    public Whitelist removeAttributes​(java.lang.String tag,
                                      java.lang.String... attributes)

Deprecated.
Description copied from class: `Safelist`
Remove a list of allowed attributes from a tag. (If an attribute is not allowed on an element, it will be removed.)

E.g.: `removeAttributes("a", "href", "class")` disallows `href` and `class` attributes on `a` tags.

To make an attribute invalid for all tags, use the pseudo tag `:all`, e.g. `removeAttributes(":all", "class")`.

Overrides:
  `removeAttributes` in class `Safelist`
Parameters:
  `tag` - The tag the attributes are for.
  `attributes` - List of invalid attributes for the tag
Returns:
  this (for chaining)

#### addEnforcedAttribute

    public Whitelist addEnforcedAttribute​(java.lang.String tag,
                                          java.lang.String attribute,
                                          java.lang.String value)

Deprecated.
Description copied from class: `Safelist`
Add an enforced attribute to a tag. An enforced attribute will always be added to the element. If the element already has the attribute set, it will be overridden with this value.

E.g.: `addEnforcedAttribute("a", "rel", "nofollow")` will make all `a` tags output as `<a href="..." rel="nofollow">`

Overrides:
  `addEnforcedAttribute` in class `Safelist`
Parameters:
  `tag` - The tag the enforced attribute is for. The tag will be added to the allowed tag list if necessary.
  `attribute` - The attribute name
  `value` - The enforced attribute value
Returns:
  this (for chaining)

#### removeEnforcedAttribute

    public Whitelist removeEnforcedAttribute​(java.lang.String tag,
                                             java.lang.String attribute)

Deprecated.
Description copied from class: `Safelist`
Remove a previously configured enforced attribute from a tag.

Overrides:
  `removeEnforcedAttribute` in class `Safelist`
Parameters:
  `tag` - The tag the enforced attribute is for.
  `attribute` - The attribute name
Returns:
  this (for chaining)

#### preserveRelativeLinks

    public Whitelist preserveRelativeLinks​(boolean preserve)

Deprecated.
Description copied from class: `Safelist`
Configure this Safelist to preserve relative links in an element's URL attribute, or convert them to absolute links. By default, this is false: URLs will be made absolute (e.g. start with an allowed protocol, like e.g. `http://`.

Note that when handling relative links, the input document must have an appropriate `base URI` set when parsing, so that the link's protocol can be confirmed. Regardless of the setting of the `preserve relative links` option, the link must be resolvable against the base URI to an allowed protocol; otherwise the attribute will be removed.

Overrides:
  `preserveRelativeLinks` in class `Safelist`
Parameters:
  `preserve` - `true` to allow relative links, `false` (default) to deny
Returns:
  this Safelist, for chaining.
See Also:
  `Safelist.addProtocols(java.lang.String, java.lang.String, java.lang.String...)`

#### addProtocols

    public Whitelist addProtocols​(java.lang.String tag,
                                  java.lang.String attribute,
                                  java.lang.String... protocols)

Deprecated.
Description copied from class: `Safelist`
Add allowed URL protocols for an element's URL attribute. This restricts the possible values of the attribute to URLs with the defined protocol.

E.g.: `addProtocols("a", "href", "ftp", "http", "https")`

To allow a link to an in-page URL anchor (i.e. `<a href="#anchor">`, add a `#`:
E.g.: `addProtocols("a", "href", "#")`

Overrides:
  `addProtocols` in class `Safelist`
Parameters:
  `tag` - Tag the URL protocol is for
  `attribute` - Attribute name
  `protocols` - List of valid protocols
Returns:
  this, for chaining

#### removeProtocols

    public Whitelist removeProtocols​(java.lang.String tag,
                                     java.lang.String attribute,
                                     java.lang.String... removeProtocols)

Deprecated.
Description copied from class: `Safelist`
Remove allowed URL protocols for an element's URL attribute. If you remove all protocols for an attribute, that attribute will allow any protocol.

E.g.: `removeProtocols("a", "href", "ftp")`

Overrides:
  `removeProtocols` in class `Safelist`
Parameters:
  `tag` - Tag the URL protocol is for
  `attribute` - Attribute name
  `removeProtocols` - List of invalid protocols
Returns:
  this, for chaining

#### isSafeTag

    protected boolean isSafeTag​(java.lang.String tag)

Deprecated.
Description copied from class: `Safelist`
Test if the supplied tag is allowed by this safelist

Overrides:
  `isSafeTag` in class `Safelist`
Parameters:
  `tag` - test tag
Returns:
  true if allowed

#### isSafeAttribute

    protected boolean isSafeAttribute​(java.lang.String tagName,
                                      Element el,
                                      Attribute attr)

Deprecated.
Description copied from class: `Safelist`
Test if the supplied attribute is allowed by this safelist for this tag

Overrides:
  `isSafeAttribute` in class `Safelist`
Parameters:
  `tagName` - tag to consider allowing the attribute in
  `el` - element under test, to confirm protocol
  `attr` - attribute under test
Returns:
  true if allowed