import * as parse5 from 'parse5' ; import { Element } from './parser' ; import { IContentOptions , normalizeContent } from '../utils/content' ; export abstract class HtmlUtils { public static getAttributeValue ( element , attributeName ) { for ( let attribute of element . attrs ) { if ( attribute . name === attributeName ) { return attribute . value ; } } return null ; } public static getElementContent ( element , options ) { let content = parse5 . serialize ( element , { } ) ; content = content . replace ( /&amp;/g , '&' ) . replace ( /&lt;/g , '<' ) . replace ( /&gt;/g , '>' ) ; return normalizeContent ( content , options ) ; } }