diff --git a/jquery.css3finalize.js b/jquery.css3finalize.js index 9a3665a..e625a0c 100644 --- a/jquery.css3finalize.js +++ b/jquery.css3finalize.js @@ -3,7 +3,7 @@ * @copyright 2012 zencodez.net * @license http://creativecommons.org/licenses/by-sa/3.0/ * @package Css3-Finalize - * @version 2.3 - 2012-02-14 + * @version 2.4 - 2012-05-07 * @website https://github.com/codler/jQuery-Css3-Finalize * * == Description == @@ -111,7 +111,7 @@ } function cssCamelCase(css) { var s = $.camelCase(css); - return (currentPrefix == 'ms') ? s[0].toLowerCase() + s.substr(1) : s; + return (currentPrefix == 'ms') ? s.charAt(0).toLowerCase() + s.substr(1) : s; } function cleanCss(css) { @@ -696,4 +696,4 @@ window.matchMedia = window.matchMedia || (function(doc, undefined){ return { matches: bool, media: q }; }; -})(document); \ No newline at end of file +})(document); diff --git a/jquery.css3finalize.min.js b/jquery.css3finalize.min.js index c158e21..2d3a085 100644 --- a/jquery.css3finalize.min.js +++ b/jquery.css3finalize.min.js @@ -3,7 +3,7 @@ * @copyright 2012 zencodez.net * @license http://creativecommons.org/licenses/by-sa/3.0/ * @package Css3-Finalize - * @version 2.3 - 2012-02-14 + * @version 2.4 - 2012-05-07 * @website https://github.com/codler/jQuery-Css3-Finalize * * == Description == @@ -12,4 +12,4 @@ * == Example Usage == * $('style').cssFinalize(); // parse all style-tags */ -(function(a){if(a.cssFinalize){return}a.cssFinalizeSetup={shim:true,node:"style,link",checkMedia:true,append:true,callback:function(){}};a.fn.cssFinalize=function(b){if(!b||typeof b!="object"){b={}}b.node=this;a.cssFinalize(b);return this};a.cssFinalize=function(f){var r=document.createElement("div");f=a.extend({},a.cssFinalizeSetup,f);f.checkMedia=!!(f.checkMedia&&window.matchMedia);var g=[];var w;if(window.getComputedStyle){var m=getComputedStyle(document.documentElement,null);if(m.length){for(var v=0;v0)?'media="'+i.attr("media")+'"':"")+"/>");a("head:first").append(D);D[0].styleSheet.cssText=a.cssFinalize.cssObjToText(E)}else{i.after('")}}function c(D,E){E=y(E);if(a.trim(E)===""){return}var F=d(E);var i=[];i=G(F);function G(I){var H=[];a.each(I,function(J,L){if(L.attributes){var K=s(L.attributes);if(!a.isEmptyObject(K)){H.push({selector:n(L.selector),attributes:K})}else{if(n(L.selector)!=L.selector){H.push({selector:n(L.selector),attributes:s(L.attributes,true)})}else{if(!f.checkMedia||(f.checkMedia&&L.selector.indexOf("@media")===0&&matchMedia(L.selector.substr(7)).matches)){H.push({selector:L.selector,attributes:G(L.attributes)})}}}}});return H}D.addClass("css-finalize-read");if(i.length>0&&f.append){C(D,i)}if(a.isFunction(f.callback)){f.callback.call(D,i)}}function d(K){var F;if(w=="ms"&&a.browser.version<=8){F=B(K,"({[^{}]*})")}else{F=K.split(/({[^{}]*})/)}if(F[F.length-1].indexOf("}")==-1){F.pop()}var G=[];var D=false;var L;var I=0;var J;var H=0;while(H-1){if(!(l(D) in r.style)||D=="mask"){if(l("-"+w+"-"+D) in r.style){return"-"+w+"-"+D}}}return false}function o(H,G,J){J=J||H;if(H=="background-clip"||H=="background-origin"){r.style.cssText=J+":"+G;if(r.style[l(J)]!==undefined&&""+r.style[l(J)].indexOf(G)==-1){return G.split("-")[0]}}if(H=="transition"||H=="transition-property"){var L=G.split(/\s?,\s?/);var i=[];for(var D in L){var I,M;if(H=="transition"){I=L[D].split(" ")[0]}else{I=L[D]}if((M=t(I))!==false){i.push(M+L[D].substr(I.length))}else{i.push(L[D])}}return i.join(",")}if(w=="moz"){if(G.indexOf("calc")===0){return"-moz-"+G}if(G.indexOf("element")===0){return"-moz-"+G}}if(H=="display"){if(G.indexOf("box")===0||G.indexOf("flexbox")===0||G.indexOf("inline-flexbox")===0){return"-"+w+"-"+G}}var O;if(H=="background"||H=="background-image"){if(G.indexOf("linear-gradient")===0){if(w=="webkit"){O=G.replace(/^linear-gradient\s?\(\s?(.*?)\s?\)$/,"$1").split(/,\s?/);if(O.length==2){return"-webkit-gradient(linear, 0% 0%, 0% 100%, from("+O[0]+"), to("+O[1]+"))"}var N="";if(O.length>=3){var E="0% 0%, 0% 100%";if(O[0]==="left"){E="0% 0%, 100% 0%"}if(O.length>3){var K=O.slice(2,O.length-1);a.each(K,function(Q,R){var P=R.split(/ /);if(P.length===2){N+="color-stop("+P[1]+", "+P[0]+"),"}})}return"-webkit-gradient(linear, "+E+", from("+O[1]+"), "+N+" to("+O[O.length-1]+"))"}}else{if(w=="ms"&&a.browser.version==9){O=G.replace(/^linear-gradient\s?\(\s?(.*?)\s?\)$/,"$1").split(/,\s?/);if(O.length==2){var F='';return"url(data:image/svg+xml,"+escape(F)+")"}}}return"-"+w+"-"+G}else{if(G.indexOf("radial-gradient")===0){return"-"+w+"-"+G}}}return false}function u(E,D){if(f.shim){if(w=="ms"){if(a.browser.version<=8){if(E.toUpperCase()=="OPACITY"&&!a.support.opacity&&!isNaN(D)){return{filter:"alpha(opacity="+D*100+")",zoom:1}}if(E.toUpperCase()==="BACKGROUND-COLOR"&&D.indexOf("rgba")===0){D=b(D);return{background:"url(#)",filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='"+D+"',EndColorStr='"+D+"')"}}if((E.toUpperCase()=="BACKGROUND"||E.toUpperCase()==="BACKGROUND-IMAGE")&&D.indexOf("linear-gradient")===0){var i=D.replace(/^linear-gradient\s?\(\s?(.*?)\s?\)$/,"$1").split(/,\s?/);if(i.length==2){return{background:"url(#)",filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='"+i[0]+"',EndColorStr='"+i[1]+"')"}}}}}}return false}function n(i){if(w=="moz"){i=i.replace("::selection","::-moz-selection");i=i.replace("::placeholder",":-moz-placeholder");i=i.replace("@keyframes","@-moz-keyframes")}else{if(w=="webkit"){i=i.replace("@keyframes","@-webkit-keyframes");i=i.replace("::placeholder","::-webkit-input-placeholder")}}return i}function b(H){var E=H.replace(/^rgba\s?\(\s?(.*?)\s?\)$/,"$1").split(/,\s?/);var D=[];var G;for(var F=0;F0&&matchMedia(E.attr("media")).matches)||!E.attr("media")){k(this.href,E)}}else{if(this.tagName=="TEXTAREA"){c(E,E.val())}else{c(E,E.html())}}});function k(i,D){var I=document.location,H=I.protocol||"http:";var G=/^(\w+:)\/\/([^\/?#:]+)(?::(\d+))?/.exec(i.toLowerCase());var E=!!(G&&(G[1]!=H||G[2]!=I.hostname||(G[3]||(G[1]==="http:"?80:443))!=(I.port||(H==="http:"?80:443))));if(E){return}try{a("
").load(i,function(J){c(D,J)})}catch(F){}}for(property in p){if((newProperty=t(property))!==false){q(property,newProperty)}}for(property in g){if((newProperty=t(g[property]))!==false){q(g[property],newProperty)}}var j="background background-image background-clip background-origin transition transition-property display".split(" ");for(property in j){if(a.inArray(j[property],g)===-1){q(j[property],j[property])}}function q(D,i){i=l(i);a.cssHooks[l(D)]={get:function(G,F,E){return G.style[i]},set:function(E,G){var I=o(D,G,i);try{E.style[i]=(I)?I:G}catch(H){}var F=u(D,G);if(F){a.each(F,function(J,K){try{if(J=="filter"&&E.style[J]){E.style[J]+=" "+K}else{E.style[J]=K}}catch(L){}})}}}}};a.cssFinalize.cssObjToText=function(c,b){var d="";b=b||false;a.each(c,function(e,f){d+=f.selector+"{";if(a.isArray(f.attributes)){if(b){d+="\r\n"}d+=a.cssFinalize.cssObjToText(f.attributes,b)}else{a.each(f.attributes,function(h,g){if(b){d+="\r\n "}d+=h+":"+g+";"});if(b){d+="\r\n"}}d+="}";if(b){d+="\r\n"}});return d};a(function(){if(window.cssFinalize!==false){a.cssFinalize()}})})(jQuery);window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.appendChild(g);return function(h){g.innerHTML='­';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document); \ No newline at end of file +(function(a){if(a.cssFinalize){return}a.cssFinalizeSetup={shim:true,node:"style,link",checkMedia:true,append:true,callback:function(){}};a.fn.cssFinalize=function(b){if(!b||typeof b!="object"){b={}}b.node=this;a.cssFinalize(b);return this};a.cssFinalize=function(f){var r=document.createElement("div");f=a.extend({},a.cssFinalizeSetup,f);f.checkMedia=!!(f.checkMedia&&window.matchMedia);var g=[];var w;if(window.getComputedStyle){var m=getComputedStyle(document.documentElement,null);if(m.length){for(var v=0;v0)?'media="'+i.attr("media")+'"':"")+"/>");a("head:first").append(D);D[0].styleSheet.cssText=a.cssFinalize.cssObjToText(E)}else{i.after('")}}function c(D,E){E=y(E);if(a.trim(E)===""){return}var F=d(E);var i=[];i=G(F);function G(I){var H=[];a.each(I,function(J,L){if(L.attributes){var K=s(L.attributes);if(!a.isEmptyObject(K)){H.push({selector:n(L.selector),attributes:K})}else{if(n(L.selector)!=L.selector){H.push({selector:n(L.selector),attributes:s(L.attributes,true)})}else{if(!f.checkMedia||(f.checkMedia&&L.selector.indexOf("@media")===0&&matchMedia(L.selector.substr(7)).matches)){H.push({selector:L.selector,attributes:G(L.attributes)})}}}}});return H}D.addClass("css-finalize-read");if(i.length>0&&f.append){C(D,i)}if(a.isFunction(f.callback)){f.callback.call(D,i)}}function d(K){var F;if(w=="ms"&&a.browser.version<=8){F=B(K,"({[^{}]*})")}else{F=K.split(/({[^{}]*})/)}if(F[F.length-1].indexOf("}")==-1){F.pop()}var G=[];var D=false;var L;var I=0;var J;var H=0;while(H-1){if(!(l(D) in r.style)||D=="mask"){if(l("-"+w+"-"+D) in r.style){return"-"+w+"-"+D}}}return false}function o(H,G,J){J=J||H;if(H=="background-clip"||H=="background-origin"){r.style.cssText=J+":"+G;if(r.style[l(J)]!==undefined&&""+r.style[l(J)].indexOf(G)==-1){return G.split("-")[0]}}if(H=="transition"||H=="transition-property"){var L=G.split(/\s?,\s?/);var i=[];for(var D in L){var I,M;if(H=="transition"){I=L[D].split(" ")[0]}else{I=L[D]}if((M=t(I))!==false){i.push(M+L[D].substr(I.length))}else{i.push(L[D])}}return i.join(",")}if(w=="moz"){if(G.indexOf("calc")===0){return"-moz-"+G}if(G.indexOf("element")===0){return"-moz-"+G}}if(H=="display"){if(G.indexOf("box")===0||G.indexOf("flexbox")===0||G.indexOf("inline-flexbox")===0){return"-"+w+"-"+G}}var O;if(H=="background"||H=="background-image"){if(G.indexOf("linear-gradient")===0){if(w=="webkit"){O=G.replace(/^linear-gradient\s?\(\s?(.*?)\s?\)$/,"$1").split(/,\s?/);if(O.length==2){return"-webkit-gradient(linear, 0% 0%, 0% 100%, from("+O[0]+"), to("+O[1]+"))"}var N="";if(O.length>=3){var E="0% 0%, 0% 100%";if(O[0]==="left"){E="0% 0%, 100% 0%"}if(O.length>3){var K=O.slice(2,O.length-1);a.each(K,function(Q,R){var P=R.split(/ /);if(P.length===2){N+="color-stop("+P[1]+", "+P[0]+"),"}})}return"-webkit-gradient(linear, "+E+", from("+O[1]+"), "+N+" to("+O[O.length-1]+"))"}}else{if(w=="ms"&&a.browser.version==9){O=G.replace(/^linear-gradient\s?\(\s?(.*?)\s?\)$/,"$1").split(/,\s?/);if(O.length==2){var F='';return"url(data:image/svg+xml,"+escape(F)+")"}}}return"-"+w+"-"+G}else{if(G.indexOf("radial-gradient")===0){return"-"+w+"-"+G}}}return false}function u(E,D){if(f.shim){if(w=="ms"){if(a.browser.version<=8){if(E.toUpperCase()=="OPACITY"&&!a.support.opacity&&!isNaN(D)){return{filter:"alpha(opacity="+D*100+")",zoom:1}}if(E.toUpperCase()==="BACKGROUND-COLOR"&&D.indexOf("rgba")===0){D=b(D);return{background:"url(#)",filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='"+D+"',EndColorStr='"+D+"')"}}if((E.toUpperCase()=="BACKGROUND"||E.toUpperCase()==="BACKGROUND-IMAGE")&&D.indexOf("linear-gradient")===0){var i=D.replace(/^linear-gradient\s?\(\s?(.*?)\s?\)$/,"$1").split(/,\s?/);if(i.length==2){return{background:"url(#)",filter:"progid:DXImageTransform.Microsoft.gradient(startColorStr='"+i[0]+"',EndColorStr='"+i[1]+"')"}}}}}}return false}function n(i){if(w=="moz"){i=i.replace("::selection","::-moz-selection");i=i.replace("::placeholder",":-moz-placeholder");i=i.replace("@keyframes","@-moz-keyframes")}else{if(w=="webkit"){i=i.replace("@keyframes","@-webkit-keyframes");i=i.replace("::placeholder","::-webkit-input-placeholder")}}return i}function b(H){var E=H.replace(/^rgba\s?\(\s?(.*?)\s?\)$/,"$1").split(/,\s?/);var D=[];var G;for(var F=0;F0&&matchMedia(E.attr("media")).matches)||!E.attr("media")){k(this.href,E)}}else{if(this.tagName=="TEXTAREA"){c(E,E.val())}else{c(E,E.html())}}});function k(i,D){var I=document.location,H=I.protocol||"http:";var G=/^(\w+:)\/\/([^\/?#:]+)(?::(\d+))?/.exec(i.toLowerCase());var E=!!(G&&(G[1]!=H||G[2]!=I.hostname||(G[3]||(G[1]==="http:"?80:443))!=(I.port||(H==="http:"?80:443))));if(E){return}try{a("
").load(i,function(J){c(D,J)})}catch(F){}}for(property in p){if((newProperty=t(property))!==false){q(property,newProperty)}}for(property in g){if((newProperty=t(g[property]))!==false){q(g[property],newProperty)}}var j="background background-image background-clip background-origin transition transition-property display".split(" ");for(property in j){if(a.inArray(j[property],g)===-1){q(j[property],j[property])}}function q(D,i){i=l(i);a.cssHooks[l(D)]={get:function(G,F,E){return G.style[i]},set:function(E,G){var I=o(D,G,i);try{E.style[i]=(I)?I:G}catch(H){}var F=u(D,G);if(F){a.each(F,function(J,K){try{if(J=="filter"&&E.style[J]){E.style[J]+=" "+K}else{E.style[J]=K}}catch(L){}})}}}}};a.cssFinalize.cssObjToText=function(c,b){var d="";b=b||false;a.each(c,function(e,f){d+=f.selector+"{";if(a.isArray(f.attributes)){if(b){d+="\r\n"}d+=a.cssFinalize.cssObjToText(f.attributes,b)}else{a.each(f.attributes,function(h,g){if(b){d+="\r\n "}d+=h+":"+g+";"});if(b){d+="\r\n"}}d+="}";if(b){d+="\r\n"}});return d};a(function(){if(window.cssFinalize!==false){a.cssFinalize()}})})(jQuery);window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.appendChild(g);return function(h){g.innerHTML='­';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document);