UNPKG

require-polyfills

Version:

Collection of polyfils that load automatically using require-bundle-js by detecting what is missing in the browser.

3 lines (2 loc) 2.36 kB
"document"in self&&("classList"in document.createElement("_")&&(!document.createElementNS||"classList"in document.createElementNS("http://www.w3.org/2000/svg","g"))||function(t){"use strict";if("Element"in t){var e="classList",n="prototype",i=t.Element[n],s=Object,r=String[n].trim||function(){return this.replace(/^\s+|\s+$/g,"")},o=Array[n].indexOf||function(t){for(var e=0,n=this.length;e<n;e++)if(e in this&&this[e]===t)return e;return-1},c=function(t,e){this.name=t,this.code=DOMException[t],this.message=e},a=function(t,e){if(""===e)throw new c("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(e))throw new c("INVALID_CHARACTER_ERR","String contains an invalid character");return o.call(t,e)},l=function(t){for(var e=r.call(t.getAttribute("class")||""),n=e?e.split(/\s+/):[],i=0,s=n.length;i<s;i++)this.push(n[i]);this._updateClassName=function(){t.setAttribute("class",this.toString())}},u=l[n]=[],t=function(){return new l(this)};if(c[n]=Error[n],u.item=function(t){return this[t]||null},u.contains=function(t){return-1!==a(this,t+="")},u.add=function(){for(var t,e=arguments,n=0,i=e.length,s=!1;-1===a(this,t=e[n]+"")&&(this.push(t),s=!0),++n<i;);s&&this._updateClassName()},u.remove=function(){var t,e,n=arguments,i=0,s=n.length,r=!1;do{for(e=a(this,t=n[i]+"");-1!==e;)this.splice(e,1),r=!0,e=a(this,t)}while(++i<s);r&&this._updateClassName()},u.toggle=function(t,e){t+="";var n=this.contains(t),i=n?!0!==e&&"remove":!1!==e&&"add";return i&&this[i](t),!0===e||!1===e?e:!n},u.toString=function(){return this.join(" ")},s.defineProperty){var h={get:t,enumerable:!0,configurable:!0};try{s.defineProperty(i,e,h)}catch(t){void 0!==t.number&&-2146823252!==t.number||(h.enumerable=!1,s.defineProperty(i,e,h))}}else s[n].__defineGetter__&&i.__defineGetter__(e,t)}}(self),function(){"use strict";var t,n,e=document.createElement("_");e.classList.add("c1","c2"),e.classList.contains("c2")||((t=function(t){var i=DOMTokenList.prototype[t];DOMTokenList.prototype[t]=function(t){for(var e=arguments.length,n=0;n<e;n++)t=arguments[n],i.call(this,t)}})("add"),t("remove")),e.classList.toggle("c3",!1),e.classList.contains("c3")&&(n=DOMTokenList.prototype.toggle,DOMTokenList.prototype.toggle=function(t,e){return 1 in arguments&&!this.contains(t)==!e?e:n.call(this,t)}),e=null}()); //# sourceMappingURL=maps/polyfill-classList.min.js.map