Class DOMTokenListImpl

java.lang.Object
org.loboevolution.html.dom.domimpl.DOMTokenListImpl
All Implemented Interfaces:
DOMTokenList

public class DOMTokenListImpl extends Object implements DOMTokenList

DOMTokenListImpl class.

  • Constructor Details

    • DOMTokenListImpl

      public DOMTokenListImpl(ElementImpl element)

      Constructor for DOMTokenListImpl.

      Parameters:
      element - a ElementImpl object.
  • Method Details

    • getLength

      public int getLength()
      Returns the number of tokens.
      Specified by:
      getLength in interface DOMTokenList
      Returns:
      a Integer object.
    • item

      public String item(int index)
      Returns the token with index index.
      Specified by:
      item in interface DOMTokenList
      Parameters:
      index - a Integer object.
      Returns:
      a String object.
    • contains

      public boolean contains(String token)
      Returns true if token is present, and false otherwise.
      Specified by:
      contains in interface DOMTokenList
      Parameters:
      token - a String object.
      Returns:
      a boolean.
    • add

      public void add(String token) throws DOMException
      Adds all arguments passed, except those already present. Throws a "SyntaxError" DOMException if one of the arguments is the empty string. Throws an "InvalidCharacterError" DOMException if one of the arguments contains any ASCII whitespace.
      Specified by:
      add in interface DOMTokenList
      Parameters:
      token - a String object.
      Throws:
      DOMException
    • remove

      public void remove(String token)
      Removes arguments passed, if they are present. Throws a "SyntaxError" DOMException if one of the arguments is the empty string. Throws an "InvalidCharacterError" DOMException if one of the arguments contains any ASCII whitespace.
      Specified by:
      remove in interface DOMTokenList
      Parameters:
      token - a String object.
    • remove

      public void remove()
    • toggle

      public boolean toggle(String token) throws DOMException

      toggle.

      Specified by:
      toggle in interface DOMTokenList
      Parameters:
      token - a String object.
      Returns:
      a boolean.
      Throws:
      DOMException
    • toggle

      public boolean toggle(String token, boolean force)
      If force is not given, "toggles" token, removing it if it's present and adding it if it's not present. If force is true, adds token (same as add()). If force is false, removes token (same as remove()). Returns true if token is now present, and false otherwise. Throws a "SyntaxError" DOMException if token is empty. Throws an "InvalidCharacterError" DOMException if token contains any spaces.
      Specified by:
      toggle in interface DOMTokenList
      Parameters:
      token - a String object.
      force - a boolean.
      Returns:
      a boolean.
    • getValue

      public String getValue()
      Returns the associated set as string. Can be set, to change the associated attribute.
      Specified by:
      getValue in interface DOMTokenList
      Returns:
      a String object.
    • setValue

      public void setValue(String value) throws DOMException

      setValue.

      Specified by:
      setValue in interface DOMTokenList
      Parameters:
      value - a String object.
      Throws:
      DOMException
    • replace

      public boolean replace(String oldToken, String newToken)
      Replaces token with newToken. Returns true if token was replaced with newToken, and false otherwise. Throws a "SyntaxError" DOMException if one of the arguments is the empty string. Throws an "InvalidCharacterError" DOMException if one of the arguments contains any ASCII whitespace.
      Specified by:
      replace in interface DOMTokenList
      Parameters:
      oldToken - a String object.
      newToken - a String object.
      Returns:
      a boolean.
    • supports

      public boolean supports(String token)
      Returns true if token is in the associated attribute's supported tokens. Returns false otherwise.

      Throws a TypeError if the associated attribute has no supported tokens defined.

      Specified by:
      supports in interface DOMTokenList
      Parameters:
      token - a String object.
      Returns:
      a boolean.
    • populate

      public void populate(String token)
    • toString

      public String toString()
      Overrides:
      toString in class Object