Skip to content

Commit

Permalink
Update parseHTML to use Document.parseHTMLUnsafe where supported
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewarlow committed Feb 12, 2025
1 parent 0f9c420 commit d119934
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,9 @@ var htmx = (function() {
* @returns {Document}
*/
function parseHTML(resp) {
if ('parseHTMLUnsafe' in Document) {
return Document.parseHTMLUnsafe(resp)
}
const parser = new DOMParser()
return parser.parseFromString(resp, 'text/html')
}
Expand Down

0 comments on commit d119934

Please sign in to comment.