UNPKG

@guardian/mobile-apps-article-templates

Version:

Templates for articles on both iOS and Android next-gen apps

2 lines 2.61 kB
/*! For license information please see index.js.LICENSE.txt */ "document"in window.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},DOMEx=function(t,e){this.name=t,this.code=DOMException[t],this.message=e},checkTokenAndGetIndex=function(t,e){if(""===e)throw new DOMEx("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(e))throw new DOMEx("INVALID_CHARACTER_ERR","String contains an invalid character");return o.call(t,e)},ClassList=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())}},c=ClassList[n]=[],classListGetter=function(){return new ClassList(this)};if(DOMEx[n]=Error[n],c.item=function(t){return this[t]||null},c.contains=function(t){return-1!==checkTokenAndGetIndex(this,t+="")},c.add=function(){var t,e=arguments,n=0,i=e.length,s=!1;do{-1===checkTokenAndGetIndex(this,t=e[n]+"")&&(this.push(t),s=!0)}while(++n<i);s&&this._updateClassName()},c.remove=function(){var t,e,n=arguments,i=0,s=n.length,r=!1;do{for(e=checkTokenAndGetIndex(this,t=n[i]+"");-1!==e;)this.splice(e,1),r=!0,e=checkTokenAndGetIndex(this,t)}while(++i<s);r&&this._updateClassName()},c.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},c.toString=function(){return this.join(" ")},s.defineProperty){var a={get:classListGetter,enumerable:!0,configurable:!0};try{s.defineProperty(i,e,a)}catch(t){void 0!==t.number&&-2146823252!==t.number||(a.enumerable=!1,s.defineProperty(i,e,a))}}else s[n].__defineGetter__&&i.__defineGetter__(e,classListGetter)}}(window.self),function(){"use strict";var t=document.createElement("_");if(t.classList.add("c1","c2"),!t.classList.contains("c2")){var createMethod=function(t){var e=DOMTokenList.prototype[t];DOMTokenList.prototype[t]=function(t){var n,i=arguments.length;for(n=0;n<i;n++)t=arguments[n],e.call(this,t)}};createMethod("add"),createMethod("remove")}if(t.classList.toggle("c3",!1),t.classList.contains("c3")){var e=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(t,n){return 1 in arguments&&!this.contains(t)==!n?n:e.call(this,t)}}t=null}());