export const relocateMetaCharset = ( doc ) => { const head = doc . head ; let charsetElm = head . querySelector ( 'meta[charset]' ) ; if ( charsetElm == null ) { charsetElm = doc . createElement ( 'meta' ) ; charsetElm . setAttribute ( 'charset' , 'utf-8' ) ; } else { charsetElm . remove ( ) ; } head . insertBefore ( charsetElm , head . firstChild ) ; } ;