UNPKG

@seznam/szn-select

Version:

Accessible HTML selectbox with customizable UI. Based on web components and easy to integrate with various frameworks like React or Angular.

1 lines 2.41 kB
!function(){var e=document.createDocumentFragment();if(e.appendChild(document.createElement("div")),!e.firstElementChild){var t=document.createDocumentFragment;function n(e){for(var t=e.firstChild;t&&t.nodeType!==Node.ELEMENT_NODE;)t=t.nextSibling;return t}function r(e){for(var t=e.lastChild;t&&t.nodeType!==Node.ELEMENT_NODE;)t=t.previousSibling;return t}document.createDocumentFragment=function(){var e=t.apply(document,arguments);return Object.defineProperty(e,"firstElementChild",{get:function(){return n(e)}}),Object.defineProperty(e,"lastElementChild",{get:function(){return r(e)}}),e},self.DocumentFragment&&(Object.defineProperty(DocumentFragment.prototype,"firstElementChild",{enumerable:!0,configurable:!0,get:function(){return n(this)}}),Object.defineProperty(DocumentFragment.prototype,"lastElementChild",{enumerable:!0,configurable:!0,get:function(){return r(this)}}))}}(),"content"in document.createElement("template")||function(){var e=document.createElement;document.createElement=function(){var t=e.apply(document,arguments);return"TEMPLATE"===t.nodeName&&o(t),t};for(var t=Array.prototype.slice.call(document.querySelectorAll("template")),n=t.length-1;n>=0;n--)o(t[n]);var r=document.createElement("style");r.setAttribute("type","text/css");try{r.innerHTML="template { display: none; }"}catch(e){r.styleSheet.cssText="template { display: none; }"}function o(e){var t=document.createDocumentFragment();for(e.content=t;e.firstChild;)t.appendChild(e.firstChild);Object.defineProperty(e,"innerHTML",{get:function(){for(var e="",n=t.firstChild;n;)e+=n.nodeType===Node.ELEMENT_NODE?n.outerHTML:n.nodeValue;return e},set:function(e){for(;t.firstChild;)t.removeChild(t.firstChild);var n=document.createElement("div");for(n.innerHTML=e;n.firstChild;)t.appendChild(n.firstChild)}})}document.head.insertBefore(r,document.head.firstChild)}(),function(){try{var e=new window.CustomEvent("test");if(e.preventDefault(),!0!==e.defaultPrevented)throw new Error("Could not prevent default")}catch(e){var t=function(e,t){var n,r;return t=t||{bubbles:!1,cancelable:!1,detail:void 0},(n=document.createEvent("CustomEvent")).initCustomEvent(e,t.bubbles,t.cancelable,t.detail),r=n.preventDefault,n.preventDefault=function(){r.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(e){this.defaultPrevented=!0}},n};t.prototype=window.Event.prototype,window.CustomEvent=t}}();