/* Polyfill service DEVELOPMENT MODE - for live use set NODE_ENV to 'production' * For detailed credits and licence information see http://github.com/financial-times/polyfill-service. * * UA detected: ie/8.0.0 * Features requested: HTMLPictureElement,default * * - ~html5-elements, License: MIT (required by "HTMLPictureElement", "default") * - HTMLPictureElement, License: MIT * - Object.defineProperty, License: CC0 (required by "Array.from", "Array.isArray", "Array.of", "Array.prototype.fill", "CustomEvent", "Element.prototype.classList", "Event", "Event.DOMContentLoaded", "Function.prototype.bind", "Map", "Object.create", "Object.defineProperties", "Object.getOwnPropertyDescriptor", "Promise", "Set", "Symbol", "Symbol.iterator", "Symbol.species", "URL", "XMLHttpRequest", "default", "location.origin") * - Array.from, License: CC0 (required by "default") * - Array.isArray, License: CC0 (required by "Promise", "default") * - Array.of, License: CC0 (required by "default") * - Array.prototype.every, License: CC0 (required by "default") * - Array.prototype.fill, License: CC0 (required by "default") * - Array.prototype.filter, License: CC0 (required by "Map", "Set", "Symbol", "Symbol.iterator", "Symbol.species", "default") * - Array.prototype.forEach, License: CC0 (required by "Map", "Set", "Symbol", "Symbol.iterator", "Symbol.species", "URL", "default") * - Array.prototype.indexOf, License: CC0 (required by "Map", "Set", "default") * - Array.prototype.lastIndexOf, License: CC0 (required by "default") * - Array.prototype.map, License: CC0 (required by "default") * - Array.prototype.reduce, License: CC0 (required by "default") * - Array.prototype.reduceRight, License: CC0 (required by "default") * - Array.prototype.some, License: CC0 (required by "default") * - Document, License: CC0 (required by "CustomEvent", "Element", "Element.prototype.after", "Element.prototype.append", "Element.prototype.before", "Element.prototype.classList", "Element.prototype.cloneNode", "Element.prototype.closest", "Element.prototype.matches", "Element.prototype.prepend", "Element.prototype.remove", "Element.prototype.replaceWith", "Event", "Event.DOMContentLoaded", "Node.prototype.contains", "XMLHttpRequest", "_mutation", "default", "document.querySelector") * - Element, License: CC0 (required by "CustomEvent", "Element.prototype.after", "Element.prototype.append", "Element.prototype.before", "Element.prototype.classList", "Element.prototype.cloneNode", "Element.prototype.closest", "Element.prototype.matches", "Element.prototype.prepend", "Element.prototype.remove", "Element.prototype.replaceWith", "Event", "Event.DOMContentLoaded", "Node.prototype.contains", "XMLHttpRequest", "_mutation", "default", "document.querySelector") * - Event, License: CC0 (required by "CustomEvent", "Event.DOMContentLoaded", "XMLHttpRequest", "default") * - CustomEvent, License: CC0 (required by "default") * - _DOMTokenList, License: CC0 (required by "DOMTokenList", "Element.prototype.classList", "default") * - DOMTokenList, License: CC0 (required by "default") * - Date.now, License: CC0 (required by "default", "performance.now", "requestAnimationFrame") * - Date.prototype.toISOString, License: CC0 (required by "default") * - _mutation, License: CC0 (required by "Element.prototype.after", "Element.prototype.append", "Element.prototype.before", "Element.prototype.prepend", "Element.prototype.remove", "Element.prototype.replaceWith", "default") * - Element.prototype.after, License: CC0 (required by "default") * - Element.prototype.append, License: CC0 (required by "default") * - Element.prototype.before, License: CC0 (required by "default") * - Element.prototype.classList, License: CC0 (required by "default") * - Element.prototype.cloneNode, License: CC0 (required by "default") * - document.querySelector, License: CC0 (required by "Element.prototype.closest", "Element.prototype.matches", "default") * - Element.prototype.matches, License: CC0 (required by "Element.prototype.closest", "default") * - Element.prototype.closest, License: CC0 (required by "default") * - Element.prototype.prepend, License: CC0 (required by "default") * - Element.prototype.remove, License: CC0 (required by "default") * - Element.prototype.replaceWith, License: CC0 (required by "default") * - Event.DOMContentLoaded, License: CC0 (required by "default") * - Function.prototype.bind, License: MIT (required by "Map", "Object.getOwnPropertyDescriptor", "Set", "Symbol", "default") * - Object.defineProperties, License: CC0 (required by "Map", "Object.create", "Set", "Symbol", "URL", "default", "location.origin") * - Object.create, License: CC0 (required by "Map", "Set", "Symbol", "Symbol.iterator", "Symbol.species", "default") * - Object.getOwnPropertyNames, License: CC0 (required by "Map", "Set", "Symbol", "Symbol.iterator", "Symbol.species", "default") * - Object.getOwnPropertyDescriptor, License: CC0 (required by "Map", "Set", "Symbol", "Symbol.iterator", "Symbol.species", "default") * - Object.keys, License: CC0 (required by "Map", "Set", "Symbol", "Symbol.iterator", "Symbol.species", "default") * - Symbol, License: MIT (required by "Map", "Set", "Symbol.iterator", "Symbol.species", "default") * - Symbol.iterator, License: MIT (required by "Map", "Set", "default") * - Symbol.species, License: MIT (required by "Map", "Set", "default") * - Number.isNaN, License: MIT (required by "Map", "Set", "default") * - Map, License: CC0 (required by "default") * - Node.prototype.contains, License: CC0 (required by "default") * - Object.assign, License: CC0 (required by "default") * - Object.getPrototypeOf, License: CC0 (required by "default") * - setImmediate, License: CC0 (required by "Promise", "default") * - Promise, License: MIT (required by "default") * - Set, License: CC0 (required by "default") * - String.prototype.endsWith, License: CC0 (required by "default") * - String.prototype.includes, License: CC0 (required by "default") * - String.prototype.startsWith, License: CC0 (required by "default") * - String.prototype.trim, License: CC0 (required by "default") * - URL, License: CC0 (required by "default") * - XMLHttpRequest, License: CC0 (required by "default") * - atob, License: MIT (required by "default") * - location.origin, License: CC0 (required by "default") * - performance.now, License: CC0 (required by "default", "requestAnimationFrame") * - requestAnimationFrame, License: MIT (required by "default") */ (function(undefined) { if (!(// Primitive detect for HTML5 element support - add a
element and check that it acquires block display mode by default (function() { var p = document.createElement('p'); var result = false; p.innerHTML = '
'; document.documentElement.appendChild(p); if (p.firstChild) { if ('getComputedStyle' in window) { result = (getComputedStyle(p.firstChild).display === 'block'); } else if (p.firstChild.currentStyle) { result = (p.firstChild.currentStyle.display === 'block'); } } document.documentElement.removeChild(p); return result; })())) { // ~html5-elements /** * @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed */ ;(function(window, document) { /*jshint evil:true */ /** version */ var version = '3.7.3'; /** Preset options */ var options = window.html5 || {}; /** Used to skip problem elements */ var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; /** Not all elements can be cloned in IE **/ var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i; /** Detect whether the browser supports default html5 styles */ var supportsHtml5Styles; /** Name of the expando, to work with multiple documents or to re-shiv one document */ var expando = '_html5shiv'; /** The id for the the documents expando */ var expanID = 0; /** Cached data for each document */ var expandoData = {}; /** Detect whether the browser supports unknown elements */ var supportsUnknownElements; (function() { try { var a = document.createElement('a'); a.innerHTML = ''; //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles supportsHtml5Styles = ('hidden' in a); supportsUnknownElements = a.childNodes.length == 1 || (function() { // assign a false positive if unable to shiv (document.createElement)('a'); var frag = document.createDocumentFragment(); return ( typeof frag.cloneNode == 'undefined' || typeof frag.createDocumentFragment == 'undefined' || typeof frag.createElement == 'undefined' ); }()); } catch(e) { // assign a false positive if detection fails => unable to shiv supportsHtml5Styles = true; supportsUnknownElements = true; } }()); /*--------------------------------------------------------------------------*/ /** * Creates a style sheet with the given CSS text and adds it to the document. * @private * @param {Document} ownerDocument The document. * @param {String} cssText The CSS text. * @returns {StyleSheet} The style element. */ function addStyleSheet(ownerDocument, cssText) { var p = ownerDocument.createElement('p'), parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; p.innerHTML = 'x'; return parent.insertBefore(p.lastChild, parent.firstChild); } /** * Returns the value of `html5.elements` as an array. * @private * @returns {Array} An array of shived element node names. */ function getElements() { var elements = html5.elements; return typeof elements == 'string' ? elements.split(' ') : elements; } /** * Extends the built-in list of html5 elements * @memberOf html5 * @param {String|Array} newElements whitespace separated list or array of new element names to shiv * @param {Document} ownerDocument The context document. */ function addElements(newElements, ownerDocument) { var elements = html5.elements; if(typeof elements != 'string'){ elements = elements.join(' '); } if(typeof newElements != 'string'){ newElements = newElements.join(' '); } html5.elements = elements +' '+ newElements; shivDocument(ownerDocument); } /** * Returns the data associated to the given document * @private * @param {Document} ownerDocument The document. * @returns {Object} An object of data. */ function getExpandoData(ownerDocument) { var data = expandoData[ownerDocument[expando]]; if (!data) { data = {}; expanID++; ownerDocument[expando] = expanID; expandoData[expanID] = data; } return data; } /** * returns a shived element for the given nodeName and document * @memberOf html5 * @param {String} nodeName name of the element * @param {Document|DocumentFragment} ownerDocument The context document. * @returns {Object} The shived element. */ function createElement(nodeName, ownerDocument, data){ if (!ownerDocument) { ownerDocument = document; } if(supportsUnknownElements){ return ownerDocument.createElement(nodeName); } if (!data) { data = getExpandoData(ownerDocument); } var node; if (data.cache[nodeName]) { node = data.cache[nodeName].cloneNode(); } else if (saveClones.test(nodeName)) { node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); } else { node = data.createElem(nodeName); } // Avoid adding some elements to fragments in IE < 9 because // * Attributes like `name` or `type` cannot be set/changed once an element // is inserted into a document/fragment // * Link elements with `src` attributes that are inaccessible, as with // a 403 response, will cause the tab/window to crash // * Script elements appended to fragments will execute when their `src` // or `text` property is set return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node; } /** * returns a shived DocumentFragment for the given document * @memberOf html5 * @param {Document} ownerDocument The context document. * @returns {Object} The shived DocumentFragment. */ function createDocumentFragment(ownerDocument, data){ if (!ownerDocument) { ownerDocument = document; } if(supportsUnknownElements){ return ownerDocument.createDocumentFragment(); } data = data || getExpandoData(ownerDocument); var clone = data.frag.cloneNode(), i = 0, elems = getElements(), l = elems.length; for(;i does not appear to be accessible to JS in IE8, so in IE8 the only way to detect that the polyfill has applied is to use a non-standard global exposed by the polyfill */ 'HTMLPictureElement' in this || 'picturefill' in this)) { // HTMLPictureElement /*! picturefill - v3.0.2 - 2016-02-12 * https://scottjehl.github.io/picturefill/ * Copyright (c) 2016 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT */ !function(a){var b=navigator.userAgent;a.HTMLPictureElement&&/ecko/.test(b)&&b.match(/rv\:(\d+)/)&&RegExp.$1<45&&addEventListener("resize",function(){var b,c=document.createElement("source"),d=function(a){var b,d,e=a.parentNode;"PICTURE"===e.nodeName.toUpperCase()?(b=c.cloneNode(),e.insertBefore(b,e.firstElementChild),setTimeout(function(){e.removeChild(b)})):(!a._pfLastSize||a.offsetWidth>a._pfLastSize)&&(a._pfLastSize=a.offsetWidth,d=a.sizes,a.sizes+=",100vw",setTimeout(function(){a.sizes=d}))},e=function(){var a,b=document.querySelectorAll("picture > img, img[srcset][sizes]");for(a=0;a2.7?h=c+1:(f=b-c,e=Math.pow(a-.6,1.5),g=f*e,d&&(g+=.1*e),h=a+g):h=c>1?Math.sqrt(a*b):a,h>c}function h(a){var b,c=s.getSet(a),d=!1;"pending"!==c&&(d=r,c&&(b=s.setRes(c),s.applySetCandidate(b,a))),a[s.ns].evaled=d}function i(a,b){return a.res-b.res}function j(a,b,c){var d;return!c&&b&&(c=a[s.ns].sets,c=c&&c[c.length-1]),d=k(b,c),d&&(b=s.makeUrl(b),a[s.ns].curSrc=b,a[s.ns].curCan=d,d.res||aa(d,d.set.sizes)),d}function k(a,b){var c,d,e;if(a&&b)for(e=s.parseSet(b),a=s.makeUrl(a),c=0;cc;c++)e=g[c],e[s.ns]=!0,f=e.getAttribute("srcset"),f&&b.push({srcset:f,media:e.getAttribute("media"),type:e.getAttribute("type"),sizes:e.getAttribute("sizes")})}function m(a,b){function c(b){var c,d=b.exec(a.substring(m));return d?(c=d[0],m+=c.length,c):void 0}function e(){var a,c,d,e,f,i,j,k,l,m=!1,o={};for(e=0;el?m=!0:c=l):X.test(j)&&"h"===i?((d||c)&&(m=!0),0===k?m=!0:d=k):m=!0;m||(o.url=g,a&&(o.w=a),c&&(o.d=c),d&&(o.h=d),d||c||a||(o.d=1),1===o.d&&(b.has1x=!0),o.set=b,n.push(o))}function f(){for(c(T),i="",j="in descriptor";;){if(k=a.charAt(m),"in descriptor"===j)if(d(k))i&&(h.push(i),i="",j="after descriptor");else{if(","===k)return m+=1,i&&h.push(i),void e();if("("===k)i+=k,j="in parens";else{if(""===k)return i&&h.push(i),void e();i+=k}}else if("in parens"===j)if(")"===k)i+=k,j="in descriptor";else{if(""===k)return h.push(i),void e();i+=k}else if("after descriptor"===j)if(d(k));else{if(""===k)return void e();j="in descriptor",m-=1}m+=1}}for(var g,h,i,j,k,l=a.length,m=0,n=[];;){if(c(U),m>=l)return n;g=c(V),h=[],","===g.slice(-1)?(g=g.replace(W,""),e()):f()}}function n(a){function b(a){function b(){f&&(g.push(f),f="")}function c(){g[0]&&(h.push(g),g=[])}for(var e,f="",g=[],h=[],i=0,j=0,k=!1;;){if(e=a.charAt(j),""===e)return b(),c(),h;if(k){if("*"===e&&"/"===a[j+1]){k=!1,j+=2,b();continue}j+=1}else{if(d(e)){if(a.charAt(j-1)&&d(a.charAt(j-1))||!f){j+=1;continue}if(0===i){b(),j+=1;continue}e=" "}else if("("===e)i+=1;else if(")"===e)i-=1;else{if(","===e){b(),c(),j+=1;continue}if("/"===e&&"*"===a.charAt(j+1)){k=!0,j+=2;continue}}f+=e,j+=1}}}function c(a){return k.test(a)&&parseFloat(a)>=0?!0:l.test(a)?!0:"0"===a||"-0"===a||"+0"===a?!0:!1}var e,f,g,h,i,j,k=/^(?:[+-]?[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?(?:ch|cm|em|ex|in|mm|pc|pt|px|rem|vh|vmin|vmax|vw)$/i,l=/^calc\((?:[0-9a-z \.\+\-\*\/\(\)]+)\)$/i;for(f=b(a),g=f.length,e=0;g>e;e++)if(h=f[e],i=h[h.length-1],c(i)){if(j=i,h.pop(),0===h.length)return j;if(h=h.join(" "),s.matchesMedia(h))return j}return"100vw"}b.createElement("picture");var o,p,q,r,s={},t=!1,u=function(){},v=b.createElement("img"),w=v.getAttribute,x=v.setAttribute,y=v.removeAttribute,z=b.documentElement,A={},B={algorithm:""},C="data-pfsrc",D=C+"set",E=navigator.userAgent,F=/rident/.test(E)||/ecko/.test(E)&&E.match(/rv\:(\d+)/)&&RegExp.$1>35,G="currentSrc",H=/\s+\+?\d+(e\d+)?w/,I=/(\([^)]+\))?\s*(.+)/,J=a.picturefillCFG,K="position:absolute;left:0;visibility:hidden;display:block;padding:0;border:none;font-size:1em;width:1em;overflow:hidden;clip:rect(0px, 0px, 0px, 0px)",L="font-size:100%!important;",M=!0,N={},O={},P=a.devicePixelRatio,Q={px:1,"in":96},R=b.createElement("a"),S=!1,T=/^[ \t\n\r\u000c]+/,U=/^[, \t\n\r\u000c]+/,V=/^[^ \t\n\r\u000c]+/,W=/[,]+$/,X=/^\d+$/,Y=/^-?(?:[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/,Z=function(a,b,c,d){a.addEventListener?a.addEventListener(b,c,d||!1):a.attachEvent&&a.attachEvent("on"+b,c)},$=function(a){var b={};return function(c){return c in b||(b[c]=a(c)),b[c]}},_=function(){var a=/^([\d\.]+)(em|vw|px)$/,b=function(){for(var a=arguments,b=0,c=a[0];++b in a;)c=c.replace(a[b],a[++b]);return c},c=$(function(a){return"return "+b((a||"").toLowerCase(),/\band\b/g,"&&",/,/g,"||",/min-([a-z-\s]+):/g,"e.$1>=",/max-([a-z-\s]+):/g,"e.$1<=",/calc([^)]+)/g,"($1)",/(\d+[\.]*[\d]*)([a-z]+)/g,"($1 * e.$2)",/^(?!(e.[a-z]|[0-9\.&=|><\+\-\*\(\)\/])).*/gi,"")+";"});return function(b,d){var e;if(!(b in N))if(N[b]=!1,d&&(e=b.match(a)))N[b]=e[1]*Q[e[2]];else try{N[b]=new Function("e",c(b))(Q)}catch(f){}return N[b]}}(),aa=function(a,b){return a.w?(a.cWidth=s.calcListLength(b||"100vw"),a.res=a.w/a.cWidth):a.res=a.d,a},ba=function(a){if(t){var c,d,e,f=a||{};if(f.elements&&1===f.elements.nodeType&&("IMG"===f.elements.nodeName.toUpperCase()?f.elements=[f.elements]:(f.context=f.elements,f.elements=null)),c=f.elements||s.qsa(f.context||b,f.reevaluate||f.reselect?s.sel:s.selShort),e=c.length){for(s.setupRun(f),S=!0,d=0;e>d;d++)s.fillImg(c[d],f);s.teardownRun(f)}}};o=a.console&&console.warn?function(a){console.warn(a)}:u,G in v||(G="src"),A["image/jpeg"]=!0,A["image/gif"]=!0,A["image/png"]=!0,A["image/svg+xml"]=b.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image","1.1"),s.ns=("pf"+(new Date).getTime()).substr(0,9),s.supSrcset="srcset"in v,s.supSizes="sizes"in v,s.supPicture=!!a.HTMLPictureElement,s.supSrcset&&s.supPicture&&!s.supSizes&&!function(a){v.srcset="data:,a",a.src="data:,a",s.supSrcset=v.complete===a.complete,s.supPicture=s.supSrcset&&s.supPicture}(b.createElement("img")),s.supSrcset&&!s.supSizes?!function(){var a="data:image/gif;base64,R0lGODlhAgABAPAAAP///wAAACH5BAAAAAAALAAAAAACAAEAAAICBAoAOw==",c="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",d=b.createElement("img"),e=function(){var a=d.width;2===a&&(s.supSizes=!0),q=s.supSrcset&&!s.supSizes,t=!0,setTimeout(ba)};d.onload=e,d.onerror=e,d.setAttribute("sizes","9px"),d.srcset=c+" 1w,"+a+" 9w",d.src=c}():t=!0,s.selShort="picture>img,img[srcset]",s.sel=s.selShort,s.cfg=B,s.DPR=P||1,s.u=Q,s.types=A,s.setSize=u,s.makeUrl=$(function(a){return R.href=a,R.href}),s.qsa=function(a,b){return"querySelector"in a?a.querySelectorAll(b):[]},s.matchesMedia=function(){return a.matchMedia&&(matchMedia("(min-width: 0.1em)")||{}).matches?s.matchesMedia=function(a){return!a||matchMedia(a).matches}:s.matchesMedia=s.mMQ,s.matchesMedia.apply(this,arguments)},s.mMQ=function(a){return a?_(a):!0},s.calcLength=function(a){var b=_(a,!0)||!1;return 0>b&&(b=!1),b},s.supportsType=function(a){return a?A[a]:!0},s.parseSize=$(function(a){var b=(a||"").match(I);return{media:b&&b[1],length:b&&b[2]}}),s.parseSet=function(a){return a.cands||(a.cands=m(a.srcset,a)),a.cands},s.getEmValue=function(){var a;if(!p&&(a=b.body)){var c=b.createElement("div"),d=z.style.cssText,e=a.style.cssText;c.style.cssText=K,z.style.cssText=L,a.style.cssText=L,a.appendChild(c),p=c.offsetWidth,a.removeChild(c),p=parseFloat(p,10),z.style.cssText=d,a.style.cssText=e}return p||16},s.calcListLength=function(a){if(!(a in O)||B.uT){var b=s.calcLength(n(a));O[a]=b?b:Q.width}return O[a]},s.setRes=function(a){var b;if(a){b=s.parseSet(a);for(var c=0,d=b.length;d>c;c++)aa(b[c],a.sizes)}return b},s.setRes.res=aa,s.applySetCandidate=function(a,b){if(a.length){var c,d,e,f,h,k,l,m,n,o=b[s.ns],p=s.DPR;if(k=o.curSrc||b[G],l=o.curCan||j(b,k,a[0].set),l&&l.set===a[0].set&&(n=F&&!b.complete&&l.res-.1>p,n||(l.cached=!0,l.res>=p&&(h=l))),!h)for(a.sort(i),f=a.length,h=a[f-1],d=0;f>d;d++)if(c=a[d],c.res>=p){e=d-1,h=a[e]&&(n||k!==s.makeUrl(c.url))&&g(a[e].res,c.res,p,a[e].cached)?a[e]:c;break}h&&(m=s.makeUrl(h.url),o.curSrc=m,o.curCan=h,m!==k&&s.setSrc(b,h),s.setSize(b))}},s.setSrc=function(a,b){var c;a.src=b.url,"image/svg+xml"===b.set.type&&(c=a.style.width,a.style.width=a.offsetWidth+1+"px",a.offsetWidth+1&&(a.style.width=c))},s.getSet=function(a){var b,c,d,e=!1,f=a[s.ns].sets;for(b=0;bf?c=setTimeout(e,b-f):(c=null,a())};return function(){d=new Date,c||(c=setTimeout(e,b))}},h=z.clientHeight,i=function(){M=Math.max(a.innerWidth||0,z.clientWidth)!==Q.width||z.clientHeight!==h,h=z.clientHeight,M&&s.fillImgs()};Z(a,"resize",g(i,99)),Z(b,"readystatechange",e)}(),s.picturefill=ba,s.fillImgs=ba,s.teardownRun=u,ba._=s,a.picturefillCFG={pf:s,push:function(a){var b=a.shift();"function"==typeof s[b]?s[b].apply(s,a):(B[b]=a[0],S&&s.fillImgs({reselect:!0}))}};for(;J&&J.length;)a.picturefillCFG.push(J.shift());a.picturefill=ba,"object"==typeof module&&"object"==typeof module.exports?module.exports=ba:"function"==typeof define&&define.amd&&define("picturefill",function(){return ba}),s.supPicture||(A["image/webp"]=e("image/webp","data:image/webp;base64,UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAABBxAR/Q9ERP8DAABWUDggGAAAADABAJ0BKgEAAQADADQlpAADcAD++/1QAA=="))}(window,document);/*! picturefill - v3.0.2 - 2016-02-12 * https://scottjehl.github.io/picturefill/ * Copyright (c) 2016 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT */ !function(a){"use strict";var b,c=0,d=function(){window.picturefill&&a(window.picturefill),(window.picturefill||c>9999)&&clearInterval(b),c++};b=setInterval(d,8),d()}(function(a){"use strict";var b=window.document,c=window.Element,d=window.MutationObserver,e=function(){},f={disconnect:e,take:e,observe:e,start:e,stop:e,connected:!1},g=/^loade|^c|^i/.test(b.readyState||""),h=a._;if(h.mutationSupport=!1,h.observer=f,Object.keys&&window.HTMLSourceElement&&b.addEventListener){var i,j,k,l,m={src:1,srcset:1,sizes:1,media:1},n=Object.keys(m),o={attributes:!0,childList:!0,subtree:!0,attributeFilter:n},p=c&&c.prototype,q={},r=function(a,b){q[a]=h[a],h[a]=b};p&&!p.matches&&(p.matches=p.matchesSelector||p.mozMatchesSelector||p.webkitMatchesSelector||p.msMatchesSelector),p&&p.matches&&(i=function(a,b){return a.matches(b)},h.mutationSupport=!(!Object.create||!Object.defineProperties)),h.mutationSupport&&(f.observe=function(){k&&(f.connected=!0,j&&j.observe(b.documentElement,o))},f.disconnect=function(){f.connected=!1,j&&j.disconnect()},f.take=function(){j?h.onMutations(j.takeRecords()):l&&l.take()},f.start=function(){k=!0,f.observe()},f.stop=function(){k=!1,f.disconnect()},r("setupRun",function(){return f.disconnect(),q.setupRun.apply(this,arguments)}),r("teardownRun",function(){var a=q.setupRun.apply(this,arguments);return f.observe(),a}),r("setSrc",function(){var a,b=f.connected;return f.disconnect(),a=q.setSrc.apply(this,arguments),b&&f.observe(),a}),h.onMutations=function(a){var b,c,d=[];for(b=0,c=a.length;c>b;b++)g&&"childList"===a[b].type?h.onSubtreeChange(a[b],d):"attributes"===a[b].type&&h.onAttrChange(a[b],d);d.length&&h.fillImgs({elements:d,reevaluate:!0})},h.onSubtreeChange=function(a,b){h.findAddedMutations(a.addedNodes,b),h.findRemovedMutations(a.removedNodes,a.target,b)},h.findAddedMutations=function(a,b){var c,d,e,f;for(c=0,d=a.length;d>c;c++)e=a[c],1===e.nodeType&&(f=e.nodeName.toUpperCase(),"PICTURE"===f?h.addToElements(e.getElementsByTagName("img")[0],b):"IMG"===f&&i(e,h.selShort)?h.addToElements(e,b):"SOURCE"===f?h.addImgForSource(e,e.parentNode,b):h.addToElements(h.qsa(e,h.selShort),b))},h.findRemovedMutations=function(a,b,c){var d,e,f;for(d=0,e=a.length;e>d;d++)f=a[d],1===f.nodeType&&"SOURCE"===f.nodeName.toUpperCase()&&h.addImgForSource(f,b,c)},h.addImgForSource=function(a,b,c){b&&"PICTURE"!==(b.nodeName||"").toUpperCase()&&(b=b.parentNode,b&&"PICTURE"===(b.nodeName||"").toUpperCase()||(b=null)),b&&h.addToElements(b.getElementsByTagName("img")[0],c)},h.addToElements=function(a,b){var c,d;if(a)if("length"in a&&!a.nodeType)for(c=0,d=a.length;d>c;c++)h.addToElements(a[c],b);else a.parentNode&&-1===b.indexOf(a)&&b.push(a)},h.onAttrChange=function(a,b){var c,d=a.target[h.ns];d||"srcset"!==a.attributeName||"IMG"!==(c=a.target.nodeName.toUpperCase())?d&&(c||(c=a.target.nodeName.toUpperCase()),"IMG"===c?(a.attributeName in d&&(d[a.attributeName]=void 0),h.addToElements(a.target,b)):"SOURCE"===c&&h.addImgForSource(a.target,a.target.parentNode,b)):h.addToElements(a.target,b)},h.supPicture||(d&&!h.testMutationEvents?j=new d(h.onMutations):(l=function(){var a=!1,b=[],c=window.setImmediate||window.setTimeout;return function(d){a||(a=!0,l.take||(l.take=function(){b.length&&(h.onMutations(b),b=[]),a=!1}),c(l.take)),b.push(d)}}(),b.documentElement.addEventListener("DOMNodeInserted",function(a){f.connected&&g&&l({type:"childList",addedNodes:[a.target],removedNodes:[]})},!0),b.documentElement.addEventListener("DOMNodeRemoved",function(a){f.connected&&g&&"SOURCE"===(a.target||{}).nodeName&&l({type:"childList",addedNodes:[],removedNodes:[a.target],target:a.target.parentNode})},!0),b.documentElement.addEventListener("DOMAttrModified",function(a){f.connected&&m[a.attrName]&&l({type:"attributes",target:a.target,attributeName:a.attrName})},!0)),window.HTMLImageElement&&Object.defineProperties&&!function(){var a=b.createElement("img"),c=[],d=a.getAttribute,e=a.setAttribute,f={src:1};h.supSrcset&&!h.supSizes&&(f.srcset=1),Object.defineProperties(HTMLImageElement.prototype,{getAttribute:{value:function(a){var b;return f[a]&&(b=this[h.ns])&&void 0!==b[a]?b[a]:d.apply(this,arguments)},writeable:!0,enumerable:!0,configurable:!0}}),h.supSrcset||c.push("srcset"),h.supSizes||c.push("sizes"),c.forEach(function(a){Object.defineProperty(HTMLImageElement.prototype,a,{set:function(b){e.call(this,a,b)},get:function(){return d.call(this,a)||""},enumerable:!0,configurable:!0})}),"currentSrc"in a||!function(){var a,c=function(a,b){null==b&&(b=a.src||""),Object.defineProperty(a,"pfCurrentSrc",{value:b,writable:!0})},d=c;h.supSrcset&&window.devicePixelRatio&&(a=function(a,b){var c=a.d||a.w||a.res,d=b.d||b.w||b.res;return c-d},c=function(b){var c,e,f,g,i=b[h.ns];if(i&&i.supported&&i.srcset&&i.sets&&(e=h.parseSet(i.sets[0]))&&e.sort){for(e.sort(a),f=e.length,g=e[f-1],c=0;f>c;c++)if(e[c].d>=window.devicePixelRatio){g=e[c];break}g&&(g=h.makeUrl(g.url))}d(b,g)}),b.addEventListener("load",function(a){"IMG"===a.target.nodeName.toUpperCase()&&c(a.target)},!0),Object.defineProperty(HTMLImageElement.prototype,"currentSrc",{set:function(){window.console&&console.warn&&console.warn("currentSrc can't be set on img element")},get:function(){return this.complete&&c(this),this.src||this.srcset?this.pfCurrentSrc||"":""},enumerable:!0,configurable:!0})}(),!window.HTMLSourceElement||"srcset"in b.createElement("source")||["srcset","sizes"].forEach(function(a){Object.defineProperty(window.HTMLSourceElement.prototype,a,{set:function(b){this.setAttribute(a,b)},get:function(){return this.getAttribute(a)||""},enumerable:!0,configurable:!0})})}(),f.start()),g||b.addEventListener("DOMContentLoaded",function(){g=!0}))}});} // Object.defineProperty (function (nativeDefineProperty) { var supportsAccessors = Object.prototype.hasOwnProperty('__defineGetter__'); var ERR_ACCESSORS_NOT_SUPPORTED = 'Getters & setters cannot be defined on this javascript engine'; var ERR_VALUE_ACCESSORS = 'A property cannot both have accessors and be writable or have a value'; Object.defineProperty = function defineProperty(object, property, descriptor) { // Where native support exists, assume it if (nativeDefineProperty && (object === window || object === document || object === Element.prototype || object instanceof Element)) { return nativeDefineProperty(object, property, descriptor); } var propertyString = String(property); var hasValueOrWritable = 'value' in descriptor || 'writable' in descriptor; var getterType = 'get' in descriptor && typeof descriptor.get; var setterType = 'set' in descriptor && typeof descriptor.set; if (object === null || !(object instanceof Object || typeof object === 'object')) { throw new TypeError('Object must be an object (Object.defineProperty polyfill)'); } if (!(descriptor instanceof Object)) { throw new TypeError('Descriptor must be an object (Object.defineProperty polyfill)'); } // handle descriptor.get if (getterType) { if (getterType !== 'function') { throw new TypeError('Getter expected a function (Object.defineProperty polyfill)'); } if (!supportsAccessors) { throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); } if (hasValueOrWritable) { throw new TypeError(ERR_VALUE_ACCESSORS); } object.__defineGetter__(propertyString, descriptor.get); } else { object[propertyString] = descriptor.value; } // handle descriptor.set if (setterType) { if (setterType !== 'function') { throw new TypeError('Setter expected a function (Object.defineProperty polyfill)'); } if (!supportsAccessors) { throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); } if (hasValueOrWritable) { throw new TypeError(ERR_VALUE_ACCESSORS); } object.__defineSetter__(propertyString, descriptor.set); } // OK to define value unconditionally - if a getter has been specified as well, an error would be thrown above if ('value' in descriptor) { object[propertyString] = descriptor.value; } return object; }; }(Object.defineProperty)); // Array.from // Wrapped in IIFE to prevent leaking to global scope. (function () { function parseIterable (arraylike) { var done = false; var iterableResponse; var tempArray = []; // if the iterable doesn't have next; // it is an iterable if 'next' is a function but it has not been defined on // the object itself. if (typeof arraylike.next === 'function' && arraylike.hasOwnProperty('next') === false) { while (!done) { iterableResponse = arraylike.next(); if ( iterableResponse.hasOwnProperty('value') && iterableResponse.hasOwnProperty('done') ) { if (iterableResponse.done === true) { done = true; break; // handle the case where the done value is not Boolean } else if (iterableResponse.done !== false) { break; } tempArray.push(iterableResponse.value); } else { // it does not conform to the iterable pattern break; } } } if (done) { return tempArray; } else { // something went wrong return false; return false; } } Object.defineProperty(Array, 'from', { configurable: true, value: function from(source) { // handle non-objects if (source === undefined || source === null) { throw new TypeError(source + ' is not an object'); } // handle maps that are not functions if (1 in arguments && !(arguments[1] instanceof Function)) { throw new TypeError(arguments[1] + ' is not a function'); } var arraylike = typeof source === 'string' ? source.split('') : Object(source); var map = arguments[1]; var scope = arguments[2]; var array = []; var index = -1; var length = Math.min(Math.max(Number(arraylike.length) || 0, 0), 9007199254740991); var value; // variables for rebuilding array from iterator var arrayFromIterable; // if it is an iterable treat like one arrayFromIterable = parseIterable(arraylike); //if it is a Map or a Set then handle them appropriately if ( typeof arraylike.entries === 'function' && typeof arraylike.values === 'function' ) { if (arraylike.constructor.name === 'Set' && 'values' in Set.prototype) { arrayFromIterable = parseIterable(arraylike.values()); } if (arraylike.constructor.name === 'Map' && 'entries' in Map.prototype) { arrayFromIterable = parseIterable(arraylike.entries()); } } if (arrayFromIterable) { arraylike = arrayFromIterable; length = arrayFromIterable.length; } while (++index < length) { if (index in arraylike) { value = arraylike[index]; array[index] = map ? map.call(scope, value, index) : value; } } array.length = length; return array; }, writable: true }); }()); // Array.isArray (function (toString) { Object.defineProperty(Array, 'isArray', { configurable: true, value: function isArray(object) { return toString.call(object) === '[object Array]'; }, writable: true }); })(Object.prototype.toString); // Array.of (function (slice) { Object.defineProperty(Array, 'of', { configurable: true, value: function of() { return slice.call(arguments); }, writable: true }); })(Array.prototype.slice); // Array.prototype.every Array.prototype.every = function every(callback) { if (this === undefined || this === null) { throw new TypeError(this + 'is not an object'); } if (!(callback instanceof Function)) { throw new TypeError(callback + ' is not a function'); } var object = Object(this), scope = arguments[1], arraylike = object instanceof String ? object.split('') : object, length = Number(arraylike.length) || 0, index = -1; while (++index < length) { if (index in arraylike && !callback.call(scope, arraylike[index], index, object)) { return false; } } return true; }; // Array.prototype.fill Object.defineProperty(Array.prototype, 'fill', { configurable: true, value: function fill(value) { if (this === undefined || this === null) { throw new TypeError(this + ' is not an object'); } var arrayLike = Object(this); var length = Math.max(Math.min(arrayLike.length, 9007199254740991), 0) || 0; var relativeStart = 1 in arguments ? parseInt(Number(arguments[1]), 10) || 0 : 0; relativeStart = relativeStart < 0 ? Math.max(length + relativeStart, 0) : Math.min(relativeStart, length); var relativeEnd = 2 in arguments && arguments[2] !== undefined ? parseInt(Number(arguments[2]), 10) || 0 : length; relativeEnd = relativeEnd < 0 ? Math.max(length + arguments[2], 0) : Math.min(relativeEnd, length); while (relativeStart < relativeEnd) { arrayLike[relativeStart] = value; ++relativeStart; } return arrayLike; }, writable: true }); // Array.prototype.filter Array.prototype.filter = function filter(callback) { if (this === undefined || this === null) { throw new TypeError(this + 'is not an object'); } if (!(callback instanceof Function)) { throw new TypeError(callback + ' is not a function'); } var object = Object(this), scope = arguments[1], arraylike = object instanceof String ? object.split('') : object, length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0, index = -1, result = [], element; while (++index < length) { element = arraylike[index]; if (index in arraylike && callback.call(scope, element, index, object)) { result.push(element); } } return result; }; // Array.prototype.forEach Array.prototype.forEach = function forEach(callback) { if (this === undefined || this === null) { throw new TypeError(this + 'is not an object'); } if (!(callback instanceof Function)) { throw new TypeError(callback + ' is not a function'); } var object = Object(this), scope = arguments[1], arraylike = object instanceof String ? object.split('') : object, length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0, index = -1, result = [], element; while (++index < length) { if (index in arraylike) { callback.call(scope, arraylike[index], index, object); } } }; // Array.prototype.indexOf Array.prototype.indexOf = function indexOf(searchElement) { if (this === undefined || this === null) { throw new TypeError(this + 'is not an object'); } var arraylike = this instanceof String ? this.split('') : this, length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0, index = Number(arguments[1]) || 0; index = (index < 0 ? Math.max(length + index, 0) : index) - 1; while (++index < length) { if (index in arraylike && arraylike[index] === searchElement) { return index; } } return -1; }; // Array.prototype.lastIndexOf Array.prototype.lastIndexOf = function lastIndexOf(searchElement) { if (this === undefined || this === null) { throw new TypeError(this + 'is not an object'); } var arraylike = this instanceof String ? this.split('') : this, length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0, index = Number(arguments[1]) || 0; index = 1 in arguments ? (index < 0 ? Math.max(length + index, 0) : index) + 1 : length; while (--index >= 0) { if (index in arraylike && arraylike[index] === searchElement) { return index; } } return -1; }; // Array.prototype.map Array.prototype.map = function map(callback) { if (this === undefined || this === null) { throw new TypeError(this + 'is not an object'); } if (!(callback instanceof Function)) { throw new TypeError(callback + ' is not a function'); } var object = Object(this), scope = arguments[1], arraylike = object instanceof String ? object.split('') : object, length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0, index = -1, result = [], element; while (++index < length) { if (index in arraylike) { result[index] = callback.call(scope, arraylike[index], index, object); } } return result; }; // Array.prototype.reduce Array.prototype.reduce = function reduce(callback) { if (this === undefined || this === null) { throw new TypeError(this + 'is not an object'); } if (!(callback instanceof Function)) { throw new TypeError(callback + ' is not a function'); } var object = Object(this), scope = arguments[1], arraylike = object instanceof String ? object.split('') : object, length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0, index = -1, previousValue; if (1 in arguments) { previousValue = arguments[1]; } else { while (++index < length && !(index in arraylike)) {} if (index >= length) { throw new TypeError('Reduce of empty array with no initial value'); } previousValue = arraylike[index]; } while (++index < length) { if (index in arraylike) { previousValue = callback(previousValue, arraylike[index], index, object); } } return previousValue; }; // Array.prototype.reduceRight Array.prototype.reduceRight = function reduceRight(callback) { if (this === undefined || this === null) { throw new TypeError(this + 'is not an object'); } if (!(callback instanceof Function)) { throw new TypeError(callback + ' is not a function'); } var object = Object(this), scope = arguments[1], arraylike = object instanceof String ? object.split('') : object, length = -1, index = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0, previousValue; if (1 in arguments) { previousValue = arguments[1]; } else { while (--index > length && !(index in arraylike)) {} if (index <= length) { throw new TypeError('Reduce of empty array with no initial value'); } previousValue = arraylike[index]; } while (--index > length) { if (index in arraylike) { previousValue = callback(previousValue, arraylike[index], index, object); } } return previousValue; }; // Array.prototype.some Array.prototype.some = function some(callback) { if (this === undefined || this === null) { throw new TypeError(this + 'is not an object'); } if (!(callback instanceof Function)) { throw new TypeError(callback + ' is not a function'); } var object = Object(this), scope = arguments[1], arraylike = object instanceof String ? object.split('') : object, length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0, index = -1; while (++index < length) { if (index in arraylike && callback.call(scope, arraylike[index], index, object)) { return true; } } return false; }; // Document if (this.HTMLDocument) { // IE8 // HTMLDocument is an extension of Document. If the browser has HTMLDocument but not Document, the former will suffice as an alias for the latter. this.Document = this.HTMLDocument; } else { // Create an empty function to act as the missing constructor for the document object, attach the document object as its prototype. The function needs to be anonymous else it is hoisted and causes the feature detect to prematurely pass, preventing the assignments below being made. this.Document = this.HTMLDocument = document.constructor = (new Function('return function Document() {}')()); this.Document.prototype = document; } // Element (function () { // IE8 if (window.Element && !window.HTMLElement) { window.HTMLElement = window.Element; return; } // create Element constructor window.Element = window.HTMLElement = new Function('return function Element() {}')(); // generate sandboxed iframe var vbody = document.appendChild(document.createElement('body')); var frame = vbody.appendChild(document.createElement('iframe')); // use sandboxed iframe to replicate Element functionality var frameDocument = frame.contentWindow.document; var prototype = Element.prototype = frameDocument.appendChild(frameDocument.createElement('*')); var cache = {}; // polyfill Element.prototype on an element var shiv = function (element, deep) { var childNodes = element.childNodes || [], index = -1, key, value, childNode; if (element.nodeType === 1 && element.constructor !== Element) { element.constructor = Element; for (key in cache) { value = cache[key]; element[key] = value; } } while (childNode = deep && childNodes[++index]) { shiv(childNode, deep); } return element; }; var elements = document.getElementsByTagName('*'); var nativeCreateElement = document.createElement; var interval; var loopLimit = 100; prototype.attachEvent('onpropertychange', function (event) { var propertyName = event.propertyName, nonValue = !cache.hasOwnProperty(propertyName), newValue = prototype[propertyName], oldValue = cache[propertyName], index = -1, element; while (element = elements[++index]) { if (element.nodeType === 1) { if (nonValue || element[propertyName] === oldValue) { element[propertyName] = newValue; } } } cache[propertyName] = newValue; }); prototype.constructor = Element; if (!prototype.hasAttribute) { // .hasAttribute prototype.hasAttribute = function hasAttribute(name) { return this.getAttribute(name) !== null; }; } // Apply Element prototype to the pre-existing DOM as soon as the body element appears. function bodyCheck(e) { if (!(loopLimit--)) clearTimeout(interval); if (document.body && !document.body.prototype && /(complete|interactive)/.test(document.readyState)) { shiv(document, true); if (interval && document.body.prototype) clearTimeout(interval); return (!!document.body.prototype); } return false; } if (!bodyCheck(true)) { document.onreadystatechange = bodyCheck; interval = setInterval(bodyCheck, 25); } // Apply to any new elements created after load document.createElement = function createElement(nodeName) { var element = nativeCreateElement(String(nodeName).toLowerCase()); return shiv(element); }; // remove sandboxed iframe document.removeChild(vbody); })(); // Event (function () { var unlistenableWindowEvents = { click: 1, dblclick: 1, keyup: 1, keypress: 1, keydown: 1, mousedown: 1, mouseup: 1, mousemove: 1, mouseover: 1, mouseenter: 1, mouseleave: 1, mouseout: 1, storage: 1, storagecommit: 1, textinput: 1 }; function indexOf(array, element) { var index = -1, length = array.length; while (++index < length) { if (index in array && array[index] === element) { return index; } } return -1; } var existingProto = (window.Event && window.Event.prototype) || null; window.Event = Window.prototype.Event = function Event(type, eventInitDict) { if (!type) { throw new Error('Not enough arguments'); } // Shortcut if browser supports createEvent if ('createEvent' in document) { var event = document.createEvent('Event'); var bubbles = eventInitDict && eventInitDict.bubbles !== undefined ? eventInitDict.bubbles : false; var cancelable = eventInitDict && eventInitDict.cancelable !== undefined ? eventInitDict.cancelable : false; event.initEvent(type, bubbles, cancelable); return event; } var event = document.createEventObject(); event.type = type; event.bubbles = eventInitDict && eventInitDict.bubbles !== undefined ? eventInitDict.bubbles : false; event.cancelable = eventInitDict && eventInitDict.cancelable !== undefined ? eventInitDict.cancelable : false; return event; }; if (existingProto) { Object.defineProperty(window.Event, 'prototype', { configurable: false, enumerable: false, writable: true, value: existingProto }); } if (!('createEvent' in document)) { window.addEventListener = Window.prototype.addEventListener = Document.prototype.addEventListener = Element.prototype.addEventListener = function addEventListener() { var element = this, type = arguments[0], listener = arguments[1]; if (element === window && type in unlistenableWindowEvents) { throw new Error('In IE8 the event: ' + type + ' is not available on the window object. Please see https://github.com/Financial-Times/polyfill-service/issues/317 for more information.'); } if (!element._events) { element._events = {}; } if (!element._events[type]) { element._events[type] = function (event) { var list = element._events[event.type].list, events = list.slice(), index = -1, length = events.length, eventElement; event.preventDefault = function preventDefault() { if (event.cancelable !== false) { event.returnValue = false; } }; event.stopPropagation = function stopPropagation() { event.cancelBubble = true; }; event.stopImmediatePropagation = function stopImmediatePropagation() { event.cancelBubble = true; event.cancelImmediate = true; }; event.currentTarget = element; event.relatedTarget = event.fromElement || null; event.target = event.target || event.srcElement || element; event.timeStamp = new Date().getTime(); if (event.clientX) { event.pageX = event.clientX + document.documentElement.scrollLeft; event.pageY = event.clientY + document.documentElement.scrollTop; } while (++index < length && !event.cancelImmediate) { if (index in events) { eventElement = events[index]; if (indexOf(list, eventElement) !== -1 && typeof eventElement === 'function') { eventElement.call(element, event); } } } }; element._events[type].list = []; if (element.attachEvent) { element.attachEvent('on' + type, element._events[type]); } } element._events[type].list.push(listener); }; window.removeEventListener = Window.prototype.removeEventListener = Document.prototype.removeEventListener = Element.prototype.removeEventListener = function removeEventListener() { var element = this, type = arguments[0], listener = arguments[1], index; if (element._events && element._events[type] && element._events[type].list) { index = indexOf(element._events[type].list, listener); if (index !== -1) { element._events[type].list.splice(index, 1); if (!element._events[type].list.length) { if (element.detachEvent) { element.detachEvent('on' + type, element._events[type]); } delete element._events[type]; } } } }; window.dispatchEvent = Window.prototype.dispatchEvent = Document.prototype.dispatchEvent = Element.prototype.dispatchEvent = function dispatchEvent(event) { if (!arguments.length) { throw new Error('Not enough arguments'); } if (!event || typeof event.type !== 'string') { throw new Error('DOM Events Exception 0'); } var element = this, type = event.type; try { if (!event.bubbles) { event.cancelBubble = true; var cancelBubbleEvent = function (event) { event.cancelBubble = true; (element || window).detachEvent('on' + type, cancelBubbleEvent); }; this.attachEvent('on' + type, cancelBubbleEvent); } this.fireEvent('on' + type, event); } catch (error) { event.target = element; do { event.currentTarget = element; if ('_events' in element && typeof element._events[type] === 'function') { element._events[type].call(element, event); } if (typeof element['on' + type] === 'function') { element['on' + type].call(element, event); } element = element.nodeType === 9 ? element.parentWindow : element.parentNode; } while (element && !event.cancelBubble); } return true; }; } })(); // CustomEvent this.CustomEvent = function CustomEvent(type, eventInitDict) { if (!type) { throw Error('TypeError: Failed to construct "CustomEvent": An event name must be provided.'); } var event; eventInitDict = eventInitDict || {bubbles: false, cancelable: false, detail: null}; if ('createEvent' in document) { try { event = document.createEvent('CustomEvent'); event.initCustomEvent(type, eventInitDict.bubbles, eventInitDict.cancelable, eventInitDict.detail); } catch (error) { // for browsers which don't support CustomEvent at all, we use a regular event instead event = document.createEvent('Event'); event.initEvent(type, eventInitDict.bubbles, eventInitDict.cancelable); event.detail = eventInitDict.detail; } } else { // IE8 event = new Event(type, eventInitDict); event.detail = eventInitDict && eventInitDict.detail || null; } return event; }; CustomEvent.prototype = Event.prototype; // _DOMTokenList var _DOMTokenList = (function (global) { function tokenize(token) { if (/^-?[_a-zA-Z]+[_a-zA-Z0-9-]*$/.test(token)) { return String(token); } else { throw new Error('InvalidCharacterError: DOM Exception 5'); } } function toObject(self) { for (var index = -1, object = {}, element; element = self[++index];) { object[element] = true; } return object; } function fromObject(self, object) { var array = [], token; for (token in object) { if (object[token]) { array.push(token); } } [].splice.apply(self, [0, self.length].concat(array)); } var DTL = function() {}; DTL.prototype = { constructor: DTL, item: function item(index) { return this[parseFloat(index)] || null; }, length: Array.prototype.length, toString: function toString() { return [].join.call(this, ' '); }, add: function add() { for (var object = toObject(this), index = 0, token; index in arguments; ++index) { token = tokenize(arguments[index]); object[token] = true; } fromObject(this, object); }, contains: function contains(token) { return token in toObject(this); }, remove: function remove() { for (var object = toObject(this), index = 0, token; index in arguments; ++index) { token = tokenize(arguments[index]); object[token] = false; } fromObject(this, object); }, toggle: function toggle(token) { var object = toObject(this), contains = 1 in arguments ? !arguments[1] : tokenize(token) in object; object[token] = !contains; fromObject(this, object); return !contains; } }; return DTL; })(this); // DOMTokenList (function (global, join, splice) { var nativeImpl = "DOMTokenList" in global && global.DOMTokenList; if (!nativeImpl) { global.DOMTokenList = _DOMTokenList; } else { var NativeToggle = nativeImpl.prototype.toggle; nativeImpl.prototype.toggle = function toggle(token) { if (1 in arguments) { var contains = this.contains(token); var force = !!arguments[1]; if ((contains && force) || (!contains && !force)) { return force; } } return NativeToggle.call(this, token); }; } })(this, Array.prototype.join, Array.prototype.splice); // Date.now Date.now = function now() { return new Date().getTime(); }; // Date.prototype.toISOString Date.prototype.toISOString = function toISOString() { var date = this; function pad(str, len) { var pad = "0000"; str = '' + str; return pad.substr(0, len - str.length) + str } var y = date.getUTCFullYear(), m = pad(date.getUTCMonth() + 1, 2), d = pad(date.getUTCDate(), 2), h = pad(date.getUTCHours(), 2), i = pad(date.getUTCMinutes(), 2), s = pad(date.getUTCSeconds(), 2), ms = pad(date.getUTCMilliseconds(), 3); return y +'-'+ m +'-'+ d + 'T' + h +':'+ i +':'+ s +'.'+ ms +'Z'; }; // _mutation // http://dom.spec.whatwg.org/#mutation-method-macro function _mutation(nodes) { if (!nodes.length) { throw new Error('DOM Exception 8'); } else if (nodes.length === 1) { return typeof nodes[0] === 'string' ? document.createTextNode(nodes[0]) : nodes[0]; } else { var fragment = document.createDocumentFragment(), length = nodes.length, index = -1, node; while (++index < length) { node = nodes[index]; fragment.appendChild(typeof node === 'string' ? document.createTextNode(node) : node); } return fragment; } } // Element.prototype.after Document.prototype.after = Element.prototype.after = function after() { if (this.parentNode) { this.parentNode.insertBefore(_mutation(arguments), this.nextSibling); } }; // Not all UAs support the Text constructor. Polyfill on the Text constructor only where it exists // TODO: Add a polyfill for the Text constructor, and make it a dependency of this polyfill. if ("Text" in this) { Text.prototype.after = Element.prototype.after; } // Element.prototype.append Document.prototype.append = Element.prototype.append = function append() { this.appendChild(_mutation(arguments)); }; // Element.prototype.before Document.prototype.before = Element.prototype.before = function before() { if (this.parentNode) { this.parentNode.insertBefore(_mutation(arguments), this); } }; // Not all UAs support the Text constructor. Polyfill on the Text constructor only where it exists // TODO: Add a polyfill for the Text constructor, and make it a dependency of this polyfill. if ("Text" in this) { Text.prototype.before = Element.prototype.before; } // Element.prototype.classList Object.defineProperty(Element.prototype, 'classList', { configurable: true, get: function () { function pull() { var className = (typeof element.className === "object" ? element.className.baseVal : element.className); [].splice.apply(classList, [0, classList.length].concat((className || '').replace(/^\s+|\s+$/g, '').split(/\s+/))); } function push() { if (element.attachEvent) { element.detachEvent('onpropertychange', pull); } if (typeof element.className === "object") { element.className.baseVal = original.toString.call(classList); } else { element.className = original.toString.call(classList); } if (element.attachEvent) { element.attachEvent('onpropertychange', pull); } } var element = this; var original = _DOMTokenList.prototype; var ClassList = function ClassList() {}; var classList; ClassList.prototype = new _DOMTokenList; ClassList.prototype.item = function item(index) { return pull(), original.item.apply(classList, arguments); }; ClassList.prototype.toString = function toString() { return pull(), original.toString.apply(classList, arguments); }; ClassList.prototype.add = function add() { return pull(), original.add.apply(classList, arguments), push(); }; ClassList.prototype.contains = function contains(token) { return pull(), original.contains.apply(classList, arguments); }; ClassList.prototype.remove = function remove() { return pull(), original.remove.apply(classList, arguments), push(); }; ClassList.prototype.toggle = function toggle(token) { return pull(), token = original.toggle.apply(classList, arguments), push(), token; }; classList = new ClassList; if (element.attachEvent) { element.attachEvent('onpropertychange', pull); } return classList; } }); // Element.prototype.cloneNode Element.prototype.cloneNode = (function(nativeFunc) { return function(deep) { var clone = nativeFunc.call(this, deep); if ('checked' in this) clone.checked = this.checked; return clone; } })(Element.prototype.cloneNode); // document.querySelector (function (global) { var head = document.getElementsByTagName('head')[0]; function getElementsByQuery(node, selector, one) { var generator = document.createElement(), id = 'qsa' + String(Math.random()).slice(3), style, elements; generator.innerHTML = 'x