pinafore/routes/_utils/htmlToPlainText.js
Nolan Lawson cc81a7bec6
fix(a11y): improved aria-label for status and notifications (#690)
* fix(a11y): improved aria-label for status and notifications

fixes #689

* only calculate formatted date once

* fixup tests

*  fixup tests more

* fixup

* fixup tests again
2018-11-25 01:20:58 -08:00

14 lines
316 B
JavaScript

import { mark, stop } from './marks'
let domParser = process.browser && new DOMParser()
export function htmlToPlainText (html) {
if (!html) {
return ''
}
mark('htmlToPlainText')
let res = domParser.parseFromString(html, 'text/html').documentElement.textContent
stop('htmlToPlainText')
return res
}