Type of element to select attributes from.
Object with a key of attribute name and value of attribute value.
OptionaltagName: stringOptional tagName name to include in the selector.
CSS selector based on the attributes.
InvalidAttributeError if a value in attributes could not be stringified.
Single Entry With Value
selectAttributes({ disabled: true });
// [disabled="true"]
Single Entry With Value and Tag
selectAttributes({ disabled: true }, "button");
// button[disabled="true"]
Single Entry Without Value
selectAttributes({ inert: null });
// [inert]
Multiple Entries
selectAttributes({ disabled: true, inert: null });
// [disabled="true"][inert]
Attempts to build a CSS selector string from the
attributesobject. Note that the values of theattributesobject are coerced to a string, andnullexcludes a value but only includes a name. IftagNameis specified, it is included in the resulting selector.If you specify the optional
Egeneric, you'll get autocomplete on the attributes for the element associated with that type.