@laserware/dominator
    Preparing search index...

    Module attributes

    This module provides functions for querying and manipulating attributes on HTML and SVG elements.

    Classes

    InvalidAttributeError

    Error thrown when an attribute is invalid for the operation.

    Type Aliases

    AttributeName

    Valid type for HTML/SVG attribute name.

    AttributeNameForElement

    Valid attribute names for the element of type E.

    Attributes

    Valid key/value pair representing HTML/SVG attributes (prior to stringifying). Some of the values may be null or undefined.

    AttributesDefined

    Valid key/value pair representing HTML/SVG attributes (prior to stringifying). All the values must be defined.

    AttributesSearch

    Search criteria for checking if attributes are present in an element. You can use an array of attribute names to check only if the attributes are present, or an object to search for specific values. Use null for the value if you only care about the presence of an attribute.

    AttributeValue

    Value type that can be specified as the value for an HTML/SVG attribute.

    Functions

    getAttribute

    Attempts to get the attribute name from the target. If the value is found, it is coerced to a boolean if "true" or "false", a number if numeric, or the string value if a string. If not found, returns null.

    getAttributes

    Builds an object with the keys equal to the attribute names and the value equal to the corresponding attribute value in the target. If the value is found it is coerced to a boolean if "true" or "false", a number if numeric, or the string value if a string. If not found, the value is null.

    hasAllAttributes

    Checks if the target has all of the attributes that match the search criteria.

    hasAttribute

    Checks if the target has the attribute name. If a value is specified, checks that the values match.

    hasSomeAttributes

    Checks if the target has some of the attributes that match the search criteria.

    removeAttribute

    Removes the attribute name from the target.

    removeAttributes

    Removes the attributes with names from the target.

    selectAttribute

    Attempts to build a CSS selector string from the attribute name and value. Note that the value is coerced to a string and null excludes a value but only includes a name. If tagName is specified, it is included in the resulting selector.

    selectAttributes

    Attempts to build a CSS selector string from the attributes object. Note that the values of the attributes object are coerced to a string and null excludes a value but only includes a name. If tagName is specified, it is included in the resulting selector.

    setAttribute

    Sets the attribute name of the target element to the value. The value is coerced to a string.

    setAttributes

    Sets the attributes of the target to the attributes object, where the key of the object is the attribute name and the value of the object is the attribute value.