forked from eqcss/eqcss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEQCSS-polyfills.min.js
executable file
·10 lines (10 loc) · 3.31 KB
/
EQCSS-polyfills.min.js
1
2
3
4
5
6
7
8
9
10
// EQCSS / Tommy Hodgins, Maxime Euzière / MIT license
// version 1.9.2
(function(g,d){function h(f){var c=d[f];d[f]=function(f){return a(c(f))}}function k(a,c,e){return(e=this).attachEvent("on"+a,function(a){a=a||g.event;a.preventDefault=a.preventDefault||function(){a.returnValue=!1};a.stopPropagation=a.stopPropagation||function(){a.cancelBubble=!0};try{c.call(e,a)}catch(l){}})}function a(a,c){if(c=a.length)for(;c--;)a[c].addEventListener=k;else a.addEventListener=k;return a}g.addEventListener||(a([d,g]),"Element"in g?g.Element.prototype.addEventListener=k:(d.attachEvent("onreadystatechange",
function(){a(d.all)}),h("getElementsByTagName"),h("getElementById"),h("createElement"),a(d.all)))})(window,document);
(function(g){function d(a,f,c){var e=a.document&&a.currentStyle[f].match(/([\d.]+)(%|cm|em|in|mm|pc|pt|)/)||[0,0,""],b=e[1];e=e[2];c=c?/%|em/.test(e)&&a.parentElement?d(a.parentElement,"fontSize",null):16:c;a="fontSize"==f?c:/width/i.test(f)?a.clientWidth:a.clientHeight;return"%"==e?b/100*a:"cm"==e?37.7952*b:"em"==e?b*c:"in"==e?96*b:"mm"==e?37.7952*b/10:"pc"==e?1152*b/72:"pt"==e?96*b/72:b}function h(a,f){var c="border"==f?"Width":"",e=f+"Top"+c,b=f+"Right"+c,d=f+"Bottom"+c;c=f+"Left"+c;a[f]=(a[e]==
a[b]&&a[e]==a[d]&&a[e]==a[c]?[a[e]]:a[e]==a[d]&&a[c]==a[b]?[a[e],a[b]]:a[c]==a[b]?[a[e],a[b],a[d]]:[a[e],a[b],a[d],a[c]]).join(" ")}function k(a){var f=a.currentStyle,c=d(a,"fontSize"),e=function(a){return"-"+a.toLowerCase()},b;for(b in f)if(Array.prototype.push.call(this,"styleFloat"==b?"float":b.replace(/[A-Z]/,e)),"width"==b)this[b]=a.offsetWidth+"px";else if("height"==b)this[b]=a.offsetHeight+"px";else if("styleFloat"==b)this["float"]=f[b];else if(/margin.|padding.|border.+W/.test(b)&&"auto"!=
this[b])this[b]=Math.round(d(a,b,c))+"px";else if(/^outline/.test(b))try{this[b]=f[b]}catch(l){this.outlineColor=f.color,this.outlineStyle=this.outlineStyle||"none",this.outlineWidth=this.outlineWidth||"0px",this.outline=[this.outlineColor,this.outlineWidth,this.outlineStyle].join(" ")}else this[b]=f[b];h(this,"margin");h(this,"padding");h(this,"border");this.fontSize=Math.round(c)+"px"}g.getComputedStyle||(k.prototype={constructor:k,getPropertyPriority:function(){throw Error("NotSupportedError: DOM Exception 9");
},getPropertyValue:function(a){return this[a.replace(/-\w/g,function(a){return a[1].toUpperCase()})]},item:function(a){return this[a]},removeProperty:function(){throw Error("NoModificationAllowedError: DOM Exception 7");},setProperty:function(){throw Error("NoModificationAllowedError: DOM Exception 7");},getPropertyCSSValue:function(){throw Error("NotSupportedError: DOM Exception 9");}},g.getComputedStyle=function(a){return new k(a)})})(window);
(function(g){g.querySelectorAll||(g.querySelectorAll=function(d){return"#"==d.charAt(0)?[g.getElementById(d.substr(1))]:"."==d.charAt(0)?g.getElementsByClassName(d.substr(1)):g.getElementsByTagName(d)},g.querySelector=function(d){return querySelectorAll(d)[0]})})(document);
(function(){if(Object.defineProperty&&Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(Element.prototype,"textContent")&&!Object.getOwnPropertyDescriptor(Element.prototype,"textContent").get){var g=Object.getOwnPropertyDescriptor(Element.prototype,"innerText");Object.defineProperty(Element.prototype,"textContent",{get:function(){return g.get.call(this)},set:function(d){return g.set.call(this,d)}})}})();