Created
March 20, 2019 05:59
-
-
Save blubbll/6444df76be83b15e40c60aec2f56c05c to your computer and use it in GitHub Desktop.
domparser polyfill
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//domparser polyfill | |
!function (t) { "use strict"; var e = t.prototype, r = e.parseFromString; try { if ((new t).parseFromString("", "text/html")) return; } catch (t) { console.error(t); } e.parseFromString = function (t, e) { if (/^\s*text\/html\s*(?:;|$3)/i.test(e)) { var n = document.implementation.createHTMLDocument(""); return t.toLowerCase().indexOf("<!doctype") > -1 ? n.documentElement.innerHTML = t : n.body.innerHTML = t, n; } return r.apply(this, arguments); }; }(DOMParser); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment