polyfill_ie11.min.js 16 KB

1
  1. !function(t,e){function n(t,e){var n=arguments.length>2?arguments[2]:[];if(!1===i(t))throw new TypeError(Object.prototype.toString.call(t)+"is not a function.");return t.apply(e,n)}function r(t,e,n){var r={value:n,writable:!0,enumerable:!1,configurable:!0};Object.defineProperty(t,e,r)}function o(t,e){return t[e]}function i(t){return"function"==typeof t}function s(t){if(null==t)throw TypeError();return Object(t)}function c(t,e){var n,r=(n=e,s(t)[n]);if(null!=r){if(!1===i(r))throw new TypeError("Method not callable: "+e);return r}}function a(e){switch(typeof e){case"undefined":return"undefined";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";default:return null===e?"null":"Symbol"in t&&(e instanceof t.Symbol||e.constructor===t.Symbol)?"symbol":"object"}}function u(t,e){if("string"===e)var r=["toString","valueOf"];else r=["valueOf","toString"];for(var s=0;s<r.length;++s){var c=o(t,r[s]);if(i(c)){var u=n(c,t);if("object"!==a(u))return u}}throw new TypeError("Cannot convert to primitive.")}function l(t,e){return a(t)===a(e)&&("number"===a(t)?!(!isNaN(t)||!isNaN(e))||(1/t==1/0&&1/e==-1/0||(1/t==-1/0&&1/e==1/0||t===e)):function(t,e){return t===e}(t,e))}function h(t){if("symbol"===a(t))throw new TypeError("Cannot convert a Symbol value to a number");var e=Number(t);return isNaN(e)?0:1/e==1/0||1/e==-1/0||e===1/0||e===-1/0?e:(e<0?-1:1)*Math.floor(Math.abs(e))}function p(t){var e=h(t);return e<=0?0:Math.min(e,Math.pow(2,53)-1)}function f(e){var r=arguments.length>1?arguments[1]:void 0;if("object"===a(e)){if(arguments.length<2)var o="default";else r===String?o="string":r===Number&&(o="number");var i="function"==typeof t.Symbol&&"symbol"==typeof t.Symbol.toPrimitive?c(e,t.Symbol.toPrimitive):void 0;if(void 0!==i){var s=n(i,e,[o]);if("object"!==a(s))return s;throw new TypeError("Cannot convert exotic object to primitive.")}return"default"===o&&(o="number"),u(e,o)}return e}function v(t){switch(a(t)){case"symbol":throw new TypeError("Cannot convert a Symbol value to a string");case"object":return v(f(t,String));default:return String(t)}}var d,b,g,m;"includes"in Array.prototype||r(Array.prototype,"includes",(function(t){"use strict";var e=s(this),n=p(o(e,"length"));if(0===n)return!1;var r=h(arguments[1]);if(r>=0)var i=r;else(i=n+r)<0&&(i=0);for(;i<n;){var c=o(e,v(i));if(l(t,c))return!0;i+=1}return!1})),function(t){if(!("Event"in t))return!1;try{return new Event("click"),!0}catch(t){return!1}}(t)||function(){var t={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};if("undefined"!=typeof document&&"undefined"!=typeof window){var e=window.Event&&window.Event.prototype||null;n.NONE=0,n.CAPTURING_PHASE=1,n.AT_TARGET=2,n.BUBBLING_PHASE=3,window.Event=Window.prototype.Event=n,e&&Object.defineProperty(window.Event,"prototype",{configurable:!1,enumerable:!1,writable:!0,value:e}),"createEvent"in document||(window.addEventListener=Window.prototype.addEventListener=Document.prototype.addEventListener=Element.prototype.addEventListener=function(){var e=this,n=arguments[0],r=arguments[1];if(e===window&&n in t)throw new Error("In IE8 the event: "+n+" is not available on the window object. Please see https://github.com/Financial-Times/polyfill-service/issues/317 for more information.");e._events||(e._events={}),e._events[n]||(e._events[n]=function(t){var n,r=e._events[t.type].list,o=r.slice(),i=-1,s=o.length;for(t.preventDefault=function(){!1!==t.cancelable&&(t.returnValue=!1)},t.stopPropagation=function(){t.cancelBubble=!0},t.stopImmediatePropagation=function(){t.cancelBubble=!0,t.cancelImmediate=!0},t.currentTarget=e,t.relatedTarget=t.fromElement||null,t.target=t.target||t.srcElement||e,t.timeStamp=(new Date).getTime(),t.clientX&&(t.pageX=t.clientX+document.documentElement.scrollLeft,t.pageY=t.clientY+document.documentElement.scrollTop);++i<s&&!t.cancelImmediate;)i in o&&(n=o[i],r.includes(n)&&"function"==typeof n&&n.call(e,t))},e._events[n].list=[],e.attachEvent&&e.attachEvent("on"+n,e._events[n])),e._events[n].list.push(r)},window.removeEventListener=Window.prototype.removeEventListener=Document.prototype.removeEventListener=Element.prototype.removeEventListener=function(){var t,e=this,n=arguments[0],r=arguments[1];e._events&&e._events[n]&&e._events[n].list&&-1!==(t=e._events[n].list.indexOf(r))&&(e._events[n].list.splice(t,1),e._events[n].list.length||(e.detachEvent&&e.detachEvent("on"+n,e._events[n]),delete e._events[n]))},window.dispatchEvent=Window.prototype.dispatchEvent=Document.prototype.dispatchEvent=Element.prototype.dispatchEvent=function(t){if(!arguments.length)throw new Error("Not enough arguments");if(!t||"string"!=typeof t.type)throw new Error("DOM Events Exception 0");var e=this,n=t.type;try{if(!t.bubbles){t.cancelBubble=!0;var r=function(t){t.cancelBubble=!0,(e||window).detachEvent("on"+n,r)};this.attachEvent("on"+n,r)}this.fireEvent("on"+n,t)}catch(r){t.target=e;do{t.currentTarget=e,"_events"in e&&"function"==typeof e._events[n]&&e._events[n].call(e,t),"function"==typeof e["on"+n]&&e["on"+n].call(e,t),e=9===e.nodeType?e.parentWindow:e.parentNode}while(e&&!t.cancelBubble)}return!0},document.attachEvent("onreadystatechange",(function(){"complete"===document.readyState&&document.dispatchEvent(new n("DOMContentLoaded",{bubbles:!0}))})))}function n(t,e){if(!t)throw new Error("Not enough arguments");var n;if("createEvent"in document){n=document.createEvent("Event");var r=!(!e||void 0===e.bubbles)&&e.bubbles,o=!(!e||void 0===e.cancelable)&&e.cancelable;return n.initEvent(t,r,o),n}return(n=document.createEventObject()).type=t,n.bubbles=!(!e||void 0===e.bubbles)&&e.bubbles,n.cancelable=!(!e||void 0===e.cancelable)&&e.cancelable,n}}(),"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||function(t,e){"use strict";var n=[];function r(t){this.time=t.time,this.target=t.target,this.rootBounds=t.rootBounds,this.boundingClientRect=t.boundingClientRect,this.intersectionRect=t.intersectionRect||{top:0,bottom:0,left:0,right:0,width:0,height:0};try{this.isIntersecting=!!t.intersectionRect}catch(t){}var e=this.boundingClientRect,n=e.width*e.height,r=this.intersectionRect,o=r.width*r.height;this.intersectionRatio=n?Number((o/n).toFixed(4)):this.isIntersecting?1:0}function o(t,e){var n,r,o,i=e||{};if("function"!=typeof t)throw new Error("callback must be a function");if(i.root&&1!=i.root.nodeType)throw new Error("root must be an Element");this._checkForIntersections=(n=this._checkForIntersections.bind(this),r=this.THROTTLE_TIMEOUT,o=null,function(){o||(o=setTimeout((function(){n(),o=null}),r))}),this._callback=t,this._observationTargets=[],this._queuedEntries=[],this._rootMarginValues=this._parseRootMargin(i.rootMargin),this.thresholds=this._initThresholds(i.threshold),this.root=i.root||null,this.rootMargin=this._rootMarginValues.map((function(t){return t.value+t.unit})).join(" ")}function i(t,e,n,r){"function"==typeof t.addEventListener?t.addEventListener(e,n,r||!1):"function"==typeof t.attachEvent&&t.attachEvent("on"+e,n)}function s(t,e,n,r){"function"==typeof t.removeEventListener?t.removeEventListener(e,n,r||!1):"function"==typeof t.detatchEvent&&t.detatchEvent("on"+e,n)}function c(t){var e;try{e=t.getBoundingClientRect()}catch(t){}return e?(e.width&&e.height||(e={top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.right-e.left,height:e.bottom-e.top}),e):{top:0,bottom:0,left:0,right:0,width:0,height:0}}function a(t,e){for(var n=e;n;){if(n==t)return!0;n=u(n)}return!1}function u(t){var e=t.parentNode;return e&&11==e.nodeType&&e.host?e.host:e&&e.assignedSlot?e.assignedSlot.parentNode:e}o.prototype.THROTTLE_TIMEOUT=100,o.prototype.POLL_INTERVAL=null,o.prototype.USE_MUTATION_OBSERVER=!0,o.prototype.observe=function(t){if(!this._observationTargets.some((function(e){return e.element==t}))){if(!t||1!=t.nodeType)throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:t,entry:null}),this._monitorIntersections(),this._checkForIntersections()}},o.prototype.unobserve=function(t){this._observationTargets=this._observationTargets.filter((function(e){return e.element!=t})),this._observationTargets.length||(this._unmonitorIntersections(),this._unregisterInstance())},o.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorIntersections(),this._unregisterInstance()},o.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},o.prototype._initThresholds=function(t){var e=t||[0];return Array.isArray(e)||(e=[e]),e.sort().filter((function(t,e,n){if("number"!=typeof t||isNaN(t)||t<0||t>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return t!==n[e-1]}))},o.prototype._parseRootMargin=function(t){var e=(t||"0px").split(/\s+/).map((function(t){var e=/^(-?\d*\.?\d+)(px|%)$/.exec(t);if(!e)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(e[1]),unit:e[2]}}));return e[1]=e[1]||e[0],e[2]=e[2]||e[0],e[3]=e[3]||e[1],e},o.prototype._monitorIntersections=function(){this._monitoringIntersections||(this._monitoringIntersections=!0,this.POLL_INTERVAL?this._monitoringInterval=setInterval(this._checkForIntersections,this.POLL_INTERVAL):(i(t,"resize",this._checkForIntersections,!0),i(e,"scroll",this._checkForIntersections,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in t&&(this._domObserver=new MutationObserver(this._checkForIntersections),this._domObserver.observe(e,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))))},o.prototype._unmonitorIntersections=function(){this._monitoringIntersections&&(this._monitoringIntersections=!1,clearInterval(this._monitoringInterval),this._monitoringInterval=null,s(t,"resize",this._checkForIntersections,!0),s(e,"scroll",this._checkForIntersections,!0),this._domObserver&&(this._domObserver.disconnect(),this._domObserver=null))},o.prototype._checkForIntersections=function(){var e=this._rootIsInDom(),n=e?this._getRootRect():{top:0,bottom:0,left:0,right:0,width:0,height:0};this._observationTargets.forEach((function(o){var i=o.element,s=c(i),a=this._rootContainsTarget(i),u=o.entry,l=e&&a&&this._computeTargetAndRootIntersection(i,n),h=o.entry=new r({time:t.performance&&performance.now&&performance.now(),target:i,boundingClientRect:s,rootBounds:n,intersectionRect:l});u?e&&a?this._hasCrossedThreshold(u,h)&&this._queuedEntries.push(h):u&&u.isIntersecting&&this._queuedEntries.push(h):this._queuedEntries.push(h)}),this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)},o.prototype._computeTargetAndRootIntersection=function(n,r){if("none"!=t.getComputedStyle(n).display){for(var o,i,s,a,l,h,p,f,v=c(n),d=u(n),b=!1;!b;){var g=null,m=1==d.nodeType?t.getComputedStyle(d):{};if("none"==m.display)return;if(d==this.root||d==e?(b=!0,g=r):d!=e.body&&d!=e.documentElement&&"visible"!=m.overflow&&(g=c(d)),g&&(o=g,i=v,s=void 0,a=void 0,l=void 0,h=void 0,p=void 0,f=void 0,s=Math.max(o.top,i.top),a=Math.min(o.bottom,i.bottom),l=Math.max(o.left,i.left),h=Math.min(o.right,i.right),f=a-s,!(v=(p=h-l)>=0&&f>=0&&{top:s,bottom:a,left:l,right:h,width:p,height:f})))break;d=u(d)}return v}},o.prototype._getRootRect=function(){var t;if(this.root)t=c(this.root);else{var n=e.documentElement,r=e.body;t={top:0,left:0,right:n.clientWidth||r.clientWidth,width:n.clientWidth||r.clientWidth,bottom:n.clientHeight||r.clientHeight,height:n.clientHeight||r.clientHeight}}return this._expandRectByRootMargin(t)},o.prototype._expandRectByRootMargin=function(t){var e=this._rootMarginValues.map((function(e,n){return"px"==e.unit?e.value:e.value*(n%2?t.width:t.height)/100})),n={top:t.top-e[0],right:t.right+e[1],bottom:t.bottom+e[2],left:t.left-e[3]};return n.width=n.right-n.left,n.height=n.bottom-n.top,n},o.prototype._hasCrossedThreshold=function(t,e){var n=t&&t.isIntersecting?t.intersectionRatio||0:-1,r=e.isIntersecting?e.intersectionRatio||0:-1;if(n!==r)for(var o=0;o<this.thresholds.length;o++){var i=this.thresholds[o];if(i==n||i==r||i<n!=i<r)return!0}},o.prototype._rootIsInDom=function(){return!this.root||a(e,this.root)},o.prototype._rootContainsTarget=function(t){return a(this.root||e,t)},o.prototype._registerInstance=function(){n.indexOf(this)<0&&n.push(this)},o.prototype._unregisterInstance=function(){var t=n.indexOf(this);-1!=t&&n.splice(t,1)},t.IntersectionObserver=o,t.IntersectionObserverEntry=r}(window,document),"getOwnPropertyDescriptor"in Object&&"function"==typeof Object.getOwnPropertyDescriptor&&function(){try{return"3"===Object.getOwnPropertyDescriptor("13.7",1).value}catch(t){return!1}}()||(d=Object.getOwnPropertyDescriptor,b=function(){try{return 1===Object.defineProperty(document.createElement("div"),"one",{get:function(){return 1}}).one}catch(t){return!1}},g={}.toString,m="".split,r(Object,"getOwnPropertyDescriptor",(function(t,e){var n=s(t);n=("string"===a(n)||n instanceof String)&&"[object String]"==g.call(t)?m.call(t,""):Object(t);var r,o,i=function(t){var e=f(t,String);return"symbol"===a(e)?e:v(e)}(e);if(b)try{return d(n,i)}catch(t){}if(r=n,o=i,Object.prototype.hasOwnProperty.call(r,o))return{enumerable:!0,configurable:!0,writable:!0,value:n[i]}}))),"keys"in Object&&function(){return 2===Object.keys(arguments).length}(1,2)&&function(){try{return Object.keys(""),!0}catch(t){return!1}}()||r(Object,"keys",function(){"use strict";var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.prototype.propertyIsEnumerable,r=!n.call({toString:null},"toString"),o=n.call((function(){}),"prototype");function i(){var t;try{t=Object.create({})}catch(t){return!0}return n.call(t,"__proto__")}var s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],c=function(t){var e=t.constructor;return e&&e.prototype===t},a={$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},u=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!a["$"+e]&&t.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{c(window[e])}catch(t){return!0}}catch(t){return!0}return!1}();return function(n){var a,l,h,p="[object Function]"===e.call(n),f=(a=n,l=e.call(a),(h="[object Arguments]"===l)||(h="[object Array]"!==l&&null!==a&&"object"==typeof a&&"number"==typeof a.length&&a.length>=0&&"[object Function]"===e.call(a.callee)),h),v="[object String]"===e.call(n),d=[];if(null==n)throw new TypeError("Cannot convert undefined or null to object");var b=o&&p;if(v&&n.length>0&&!t.call(n,0))for(var g=0;g<n.length;++g)d.push(String(g));if(f&&n.length>0)for(var m=0;m<n.length;++m)d.push(String(m));else for(var y in n)i()&&"__proto__"===y||b&&"prototype"===y||!t.call(n,y)||d.push(String(y));if(r)for(var w=function(t){if("undefined"==typeof window||!u)return c(t);try{return c(t)}catch(t){return!1}}(n),_=0;_<s.length;++_)w&&"constructor"===s[_]||!t.call(n,s[_])||d.push(s[_]);return d}}()),"assign"in Object||r(Object,"assign",(function(t,e){var n=s(t);if(1===arguments.length)return n;var r,i,c,a,u=Array.prototype.slice.call(arguments,1);for(r=0;r<u.length;r++){var l=u[r];for(null==l?c=[]:(a="[object String]"===Object.prototype.toString.call(l)?String(l).split(""):s(l),c=Object.keys(a)),i=0;i<c.length;i++){var h,p=c[i];try{var f=Object.getOwnPropertyDescriptor(a,p);h=void 0!==f&&!0===f.enumerable}catch(t){h=Object.prototype.propertyIsEnumerable.call(a,p)}if(h){var v=o(a,p);n[p]=v}}}return n}))}("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{});