mozilla
Your Search Results

    DOMTokenList

    The DOMTokenList interface represents a set of space-separated tokens. Such a set is returned by Element.classList, HTMLLinkElement.relList, HTMLAnchorElement.relList or HTMLAreaElement.relList. It is indexed beginning with 0 as with JavaScript Array objects. DOMTokenList is always case-sensitive.

    Properties

    This interface doesn't inherit any property.

    DOMTokenList.length Read only
    Is an integer representing the number of objects stored in the object.

    Methods

    This interface doesn't inherit any method.

    DOMTokenList.item()
    Returns an item in the list by its index (or undefined if the number is greater than or equal to the length of the list, prior to Gecko 7.0 returned null)
    DOMTokenList.contains()
    Returns true if the underlying string contains token, otherwise false
    DOMTokenList.add()
    Adds token to the underlying string
    DOMTokenList.remove()
    Removes token from the underlying string
    DOMTokenList.toggle()
    Removes token from string and returns false. If token doesn't exist it's added and the function returns true

    Specifications

    http://www.whatwg.org/specs/web-apps/current-work/#domtokenlist

    Browser compatibility

     

    See Also

    Document Tags and Contributors

    Contributors to this page: Sheppy, Crash, trevorh, kscarfone, teoli, bradleyflood, MatrixFrog
    Last updated by: bradleyflood,