let decoder ; export function decodeHtmlBrowser ( raw , asAttr = false ) { if ( ! decoder ) { decoder = document . createElement ( 'div' ) ; } if ( asAttr ) { decoder . innerHTML = `<div foo="${ raw . replace ( /"/g , '&quot;' ) }">` ; return decoder . children [ 0 ] . getAttribute ( 'foo' ) as string ; } else { decoder . innerHTML = raw ; return decoder . textContent as string ; } }