diff --git a/elementQuery.js b/elementQuery.js index bbf3bac..ed9ed51 100644 --- a/elementQuery.js +++ b/elementQuery.js @@ -176,8 +176,8 @@ } } - if (!window.addEventListener && window.attachEvent) { - // Force a repaint in IE7 and IE8 + // Force a repaint in IE7 and IE8 and Safari + if ((!window.addEventListener && window.attachEvent) || (/^((?!chrome).)*safari/i.test(navigator.userAgent))) { var className = document.documentElement.className; document.documentElement.className = " " + className; document.documentElement.className = className; diff --git a/elementQuery.min.js b/elementQuery.min.js index f80209a..bc7f05f 100644 --- a/elementQuery.min.js +++ b/elementQuery.min.js @@ -1,4 +1,4 @@ /*! elementQuery | Author: Tyson Matanich (http://matanich.com), 2013 | License: MIT */ -(function(n,t,i){"use strict";var e=n.Sizzle||jQuery.find,r={},o=function(n,t,u,o,s){if(n=f(n),n!=""){var h;o||s||(h=/^([0-9]*.?[0-9]+)(px|em)$/.exec(u),h!=null&&(o=Number(h[1]),o+""!="NaN"&&(s=h[2]))),s&&(e.compile&&e.compile(n),r[n]===i&&(r[n]={}),r[n][t]===i&&(r[n][t]={}),r[n][t][u]=[o,s])}},h=function(n,t){var i,r,f;for(i in n)for(r in n[i])if(typeof n[i][r]=="string")o(i,r,n[i][r]);else if(typeof n[i][r]=="object")for(f=0;f=0;)r=r.replace(" "+u+" "," "),e=!0;e&&n.setAttribute(t,f(r))}},u=function(){var o,h,i,s,a,u,f,v;for(o in r)if(a=e(o),a.length>0)for(h=0;h=f||i=="max-width"&&u.offsetWidth<=f||i=="min-height"&&u.offsetHeight>=f||i=="max-height"&&u.offsetHeight<=f?c(u,i,s):l(u,i,s)}!n.addEventListener&&n.attachEvent&&(v=t.documentElement.className,t.documentElement.className=" "+v,t.documentElement.className=v)};n.elementQuery=function(n,t){!n||typeof n!="object"||n.cssRules||n.rules?n||t||u():h(n,t)},n.elementQuery.selectors=function(){},n.addEventListener?(n.addEventListener("resize",u,!1),n.addEventListener("DOMContentLoaded",u,!1),n.addEventListener("load",u,!1)):n.attachEvent&&(n.attachEvent("onresize",u),n.attachEvent("onload",u))})(this,document,undefined); +(function(d,g,b){var j=d.Sizzle||jQuery.find;var l={};var k=function(m,n,r,o,p){m=c(m);if(m!=""){var q;if(!o&&!p){q=/^([0-9]*.?[0-9]+)(px|em)$/.exec(r);if(q!=null){o=Number(q[1]);if(o+""!="NaN"){p=q[2]}}}if(p){if(j.compile){j.compile(m)}if(l[m]===b){l[m]={}}if(l[m][n]===b){l[m][n]={}}l[m][n][r]=[o,p]}}};var i=function(p,q){var o,n,m;for(o in p){for(n in p[o]){if(typeof p[o][n]=="string"){k(o,n,p[o][n])}else{if(typeof p[o][n]=="object"){for(m=0;m=0){q=q.replace(" "+r+" "," ");n=true}if(n){o.setAttribute(m,c(q))}}}};var e=function(){var p,s,n,m,r,o,t;for(p in l){r=j(p);if(r.length>0){for(s=0;s=t)||(n=="max-width"&&o.offsetWidth<=t)||(n=="min-height"&&o.offsetHeight>=t)||(n=="max-height"&&o.offsetHeight<=t)){a(o,n,m)}else{h(o,n,m)}}}}}}if((!d.addEventListener&&d.attachEvent)||(/^((?!chrome).)*safari/i.test(navigator.userAgent))){var q=g.documentElement.className;g.documentElement.className=" "+q;g.documentElement.className=q}};d.elementQuery=function(n,m){if(n&&typeof n=="object"&&!(n.cssRules||n.rules)){i(n,m)}else{if(!n&&!m){e()}}};d.elementQuery.selectors=function(){};if(d.addEventListener){d.addEventListener("resize",e,false);d.addEventListener("DOMContentLoaded",e,false);d.addEventListener("load",e,false)}else{if(d.attachEvent){d.attachEvent("onresize",e);d.attachEvent("onload",e)}}}(this,document,undefined)); /*! getEmPixels | Author: Tyson Matanich (http://matanich.com), 2013 | License: MIT */ -(function(n,t){"use strict";var i="!important;",r="position:absolute"+i+"visibility:hidden"+i+"width:1em"+i+"font-size:1em"+i+"padding:0"+i;window.getEmPixels=function(u){var f,e,o;return u||(u=f=n.createElement("body"),f.style.cssText="font-size:1em"+i,t.insertBefore(f,n.body)),e=n.createElement("i"),e.style.cssText=r,u.appendChild(e),o=e.clientWidth,f?t.removeChild(f):u.removeChild(e),o}})(document,document.documentElement); \ No newline at end of file +(function(a,d){var b="!important;";var c="position:absolute"+b+"visibility:hidden"+b+"width:1em"+b+"font-size:1em"+b+"padding:0"+b;window.getEmPixels=function(e){var h;if(!e){e=h=a.createElement("body");h.style.cssText="font-size:1em"+b;d.insertBefore(h,a.body)}var g=a.createElement("i");g.style.cssText=c;e.appendChild(g);var f=g.clientWidth;if(h){d.removeChild(h)}else{e.removeChild(g)}return f}}(document,document.documentElement)); \ No newline at end of file