dashboard-ui/modules/polyfills/element.js
2023-08-31 15:30:17 +02:00

1 line
916 B
JavaScript

Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(s){for(var matches=(this.document||this.ownerDocument).querySelectorAll(s),i=matches.length;0<=--i&&matches.item(i)!==this;);return-1<i}),Element.prototype.closest||(Element.prototype.closest=function(s){var el=this;do{if(Element.prototype.matches.call(el,s))return el}while(null!==(el=el.parentElement||el.parentNode)&&1===el.nodeType);return null}),Element.prototype.remove||(Element.prototype.remove=function(s){var parentNode=this.parentNode;parentNode&&parentNode.removeChild(this)}),Element.prototype.replaceChildren||(Element.prototype.replaceChildren=function(addNodes){for(;this.lastChild;)this.removeChild(this.lastChild);addNodes&&this.append(addNodes)});