File "parseHtml.ts"
Full path: /home/fsibplc/public_html/sommilito-bank2/splide-4.1.3/src/js/utils/dom/parseHtml/parseHtml.ts
File
size: 388 B (388 B bytes)
MIME-type: text/x-java
Charset: utf-8
Download Open Edit Advanced Editor Back
import { child } from '../child/child';
/**
* Parses the provided HTML string and returns the first element.
*
* @param html - An HTML string to parse.
*
* @return An Element on success, or otherwise `undefined`.
*/
export function parseHtml<E extends HTMLElement>( html: string ): E | undefined {
return child<E>( new DOMParser().parseFromString( html, 'text/html' ).body );
}