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]
|
||||
*/
|
||||
function convertHTMLToPlaintext(html) {
|
||||
var dom = new DOMParser().parseFromString(
|
||||
html.replace('<code>', '`').replace('</code>', '`'),
|
||||
'text/html',
|
||||
);
|
||||
return dom.body.innerText;
|
||||
var x = document.createElement("div");
|
||||
x.innerHTML = html.replace('<code>', '`').replace('</code>', '`');
|
||||
return x.innerText;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user