|
|
import { NodeOrString, ElementOrString, GenericObject } from "./interfaces";
|
|
|
|
|
|
interface DomAttr {
|
|
|
/**
|
|
|
* Returns true if the requested attribute is specified on the
|
|
|
* given element, and false otherwise.
|
|
|
*/
|
|
|
has(node: NodeOrString, name: string): boolean;
|
|
|
|
|
|
/**
|
|
|
* Gets an attribute on an HTML element.
|
|
|
* Because sometimes this uses node.getAttribute, it should be a string,
|
|
|
* but it can also get any other attribute on a node, therefore it is unsafe
|
|
|
* to type just a string.
|
|
|
*/
|
|
|
get(node: ElementOrString, name: string): any;
|
|
|
|
|
|
/**
|
|
|
* Sets an attribute on an HTML element.
|
|
|
*/
|
|
|
set(node: ElementOrString, name: string, value: any): Element;
|
|
|
set(node: ElementOrString, map: GenericObject): Element;
|
|
|
|
|
|
/**
|
|
|
* Removes an attribute from an HTML element.
|
|
|
*/
|
|
|
remove(node: NodeOrString, name: string): void;
|
|
|
|
|
|
/**
|
|
|
* Returns an effective value of a property or an attribute.
|
|
|
*/
|
|
|
getNodeProp(node: NodeOrString, name: string): any;
|
|
|
}
|
|
|
|
|
|
declare const domAttr: DomAttr;
|
|
|
export = domAttr;
|
|
|
|