Use createElement
and innerHTML
instead of DOMParser
@GuillaumeGomez was concerned about browser compatibility.
This commit is contained in:
parent
5d4a7128d9
commit
e178030ea4
@ -2040,11 +2040,9 @@ function defocusSearchBar() {
|
|||||||
* @return {[string]} [The resulting plaintext]
|
* @return {[string]} [The resulting plaintext]
|
||||||
*/
|
*/
|
||||||
function convertHTMLToPlaintext(html) {
|
function convertHTMLToPlaintext(html) {
|
||||||
var dom = new DOMParser().parseFromString(
|
var x = document.createElement("div");
|
||||||
html.replace('<code>', '`').replace('</code>', '`'),
|
x.innerHTML = html.replace('<code>', '`').replace('</code>', '`');
|
||||||
'text/html',
|
return x.innerText;
|
||||||
);
|
|
||||||
return dom.body.innerText;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user