()
| 1 | export default function loadPolyFill() { |
| 2 | if (!("isConnected" in Node.prototype)) { |
| 3 | Object.defineProperty(Node.prototype, "isConnected", { |
| 4 | get() { |
| 5 | return ( |
| 6 | !this.ownerDocument || |
| 7 | !( |
| 8 | this.ownerDocument.compareDocumentPosition(this) & |
| 9 | this.DOCUMENT_POSITION_DISCONNECTED |
| 10 | ) |
| 11 | ); |
| 12 | }, |
| 13 | }); |
| 14 | } |
| 15 | |
| 16 | if (!DOMTokenList.prototype.replace) { |
| 17 | DOMTokenList.prototype.replace = function (a, b) { |
| 18 | if (this.contains(a)) { |
| 19 | this.add(b); |
| 20 | this.remove(a); |
| 21 | return true; |
| 22 | } |
| 23 | return false; |
| 24 | }; |
| 25 | } |
| 26 | |
| 27 | if (!HTMLElement.prototype.append) { |
| 28 | HTMLElement.prototype.append = function (...nodes) { |
| 29 | nodes.map((node) => this.appendChild(node)); |
| 30 | }; |
| 31 | } |
| 32 | |
| 33 | if (!HTMLElement.prototype.remove) { |
| 34 | HTMLElement.prototype.remove = function () { |
| 35 | this.parentElement.removeChild(this); |
| 36 | }; |
| 37 | } |
| 38 | |
| 39 | if (!window.queueMicrotask) { |
| 40 | window.queueMicrotask = function (callback) { |
| 41 | Promise.resolve() |
| 42 | .then(callback) |
| 43 | .catch((error) => |
| 44 | setTimeout(() => { |
| 45 | throw error; |
| 46 | }), |
| 47 | ); |
| 48 | }; |
| 49 | } |
| 50 | |
| 51 | if (!HTMLElement.prototype.getParent) { |
| 52 | HTMLElement.prototype.getParent = function (queryString) { |
| 53 | const $$ = [...document.querySelectorAll(queryString)]; |
| 54 | for (let $ of $$) if ($.contains(this)) return $; |
| 55 | return null; |
| 56 | }; |
| 57 | } |
| 58 | |
| 59 | if (!String.prototype.hashCode) { |
| 60 | Object.defineProperty(String.prototype, "hashCode", { |
nothing calls this directly
no test coverage detected