europa-core
Version:
Europa core engine for converting HTML into valid Markdown
55 lines (54 loc) • 1.99 kB
TypeScript
import { DomParentNode } from "./DomParentNode";
/**
* A cross-platform wrapper for a DOM element that exists within a {@link Dom}.
*/
export interface DomElement extends DomParentNode {
/**
* Returns the value of the attribute with the specified `name` on the wrapped DOM element.
*
* @param name - The name of the attribute whose value is to be returned.
* @return The value of the named attribute or `undefined` if no attribute exists for `name`.
*/
attr(name: string): string | undefined;
/**
* Returns the value of the style property with the specified `name` on the wrapped DOM element.
*
* `name` should always be provided in camel case.
*
* @param name - The name of the style property whose value is to be returned.
* @return The value of the named style property or `undefined` if no property exists for `name`.
*/
css(name: string): string | undefined;
/**
* Checks whether the wrapped DOM element has an attribute with the specified `name`.
*
* @param name - The name of the attribute to be checked.
* @return `true` if an attribute exists for `name` on the wrapped DOM element; otherwise `false`.
*/
hasAttr(name: string): boolean;
/**
* Returns the inner HTML of the wrapped DOM element.
*
* @return The inner HTML.
*/
innerHtml(): string;
/**
* Returns the outer HTML of the wrapped DOM element.
*
* @return The outer HTML.
*/
outerHtml(): string;
/**
* Returns the value of the property with the specified `name` on the wrapped DOM element.
*
* @param name - The name of the property whose value is to be returned.
* @return The value of the named property or `undefined` if no property exists for `name`.
*/
prop(name: string): any;
/**
* Returns the upper case tag name of the wrapped DOM element.
*
* @return The tag name.
*/
tagName(): string;
}