modernizr-rails 2.0.6 → 2.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ .DS_Store
@@ -1,5 +1,5 @@
1
1
  module Modernizr
2
2
  module Rails
3
- VERSION = "2.0.6"
3
+ VERSION = "2.6.1"
4
4
  end
5
5
  end
@@ -6,14 +6,14 @@ Gem::Specification.new do |s|
6
6
  s.version = Modernizr::Rails::VERSION
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Russ Frisch"]
9
- s.email = [""]
9
+ s.email = ["russfrisch@shortmail.com"]
10
10
  s.homepage = "http://rubygems.org/gems/modernizr-rails"
11
11
  s.summary = %q{Gem wrapper to include the Modernizr.js library via the asset pipeline.}
12
12
  s.description = %q{This Modernizr.js was built using the at http://www.modernizr.com/download/ with all options enabled.}
13
13
 
14
14
  s.rubyforge_project = "modernizr-rails"
15
15
 
16
- s.add_development_dependency "rails", ">= 3.1.0.rc4"
16
+ s.add_development_dependency "rails", ">= 3.1.0"
17
17
 
18
18
  s.files = `git ls-files`.split("\n")
19
19
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
data/readme.md CHANGED
@@ -10,6 +10,16 @@ Add the following to your GemFile:<br>
10
10
  Then add the following to your application.js manifest:<br>
11
11
  `//= require modernizr`<br>
12
12
 
13
+ Or to use the minified version:
14
+
15
+ `//= require modernizr.min`<br>
16
+
17
+ Don't forget to run `bundle update` after upgrading to the latest gem version to ensure it's used by your rails app.
18
+
19
+ HTML5 Boilerplate Rails Application Template
20
+ =============================================
21
+ If you're also a fan of the HTML5 Boilerplate project (http://h5bp.com), please check out a Rails 3.1 compatible application template I created that incorporates this Modernizr-Rails gem: https://github.com/russfrisch/h5bp-rails
22
+
13
23
  Push Requests
14
24
  ==============
15
25
  This is my first Ruby Gem so if there is anything that can be done better or you would like to see tweaked, please send me a push request.
@@ -1,4 +1,1384 @@
1
- /* Modernizr 2.0.6 (Custom Build) | MIT & BSD
2
- * Contains: fontface | backgroundsize | borderimage | borderradius | boxshadow | flexbox | hsla | multiplebgs | opacity | rgba | textshadow | cssanimations | csscolumns | generatedcontent | cssgradients | cssreflections | csstransforms | csstransforms3d | csstransitions | applicationcache | canvas | canvastext | draganddrop | hashchange | history | audio | video | indexeddb | input | inputtypes | localstorage | postmessage | sessionstorage | websockets | websqldatabase | webworkers | geolocation | inlinesvg | smil | svg | svgclippaths | touch | webgl | iepp | respond | mq | cssclasses | addtest | prefixed | teststyles | testprop | testallprops | hasevent | prefixes | domprefixes | load
1
+ /*!
2
+ * Modernizr v2.6.1
3
+ * www.modernizr.com
4
+ *
5
+ * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton
6
+ * Available under the BSD and MIT licenses: www.modernizr.com/license/
3
7
  */
4
- ;window.Modernizr=function(a,b,c){function I(){e.input=function(a){for(var b=0,c=a.length;b<c;b++)t[a[b]]=a[b]in l;return t}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),e.inputtypes=function(a){for(var d=0,e,f,h,i=a.length;d<i;d++)l.setAttribute("type",f=a[d]),e=l.type!=="text",e&&(l.value=m,l.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(f)&&l.style.WebkitAppearance!==c?(g.appendChild(l),h=b.defaultView,e=h.getComputedStyle&&h.getComputedStyle(l,null).WebkitAppearance!=="textfield"&&l.offsetHeight!==0,g.removeChild(l)):/^(search|tel)$/.test(f)||(/^(url|email)$/.test(f)?e=l.checkValidity&&l.checkValidity()===!1:/^color$/.test(f)?(g.appendChild(l),g.offsetWidth,e=l.value!=m,g.removeChild(l)):e=l.value!=m)),s[a[d]]=!!e;return s}("search tel url email datetime date month week time datetime-local number range color".split(" "))}function G(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1),d=(a+" "+p.join(c+" ")+c).split(" ");return F(d,b)}function F(a,b){for(var d in a)if(k[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function E(a,b){return!!~(""+a).indexOf(b)}function D(a,b){return typeof a===b}function C(a,b){return B(o.join(a+";")+(b||""))}function B(a){k.cssText=a}var d="2.0.6",e={},f=!0,g=b.documentElement,h=b.head||b.getElementsByTagName("head")[0],i="modernizr",j=b.createElement(i),k=j.style,l=b.createElement("input"),m=":)",n=Object.prototype.toString,o=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),p="Webkit Moz O ms Khtml".split(" "),q={svg:"http://www.w3.org/2000/svg"},r={},s={},t={},u=[],v=function(a,c,d,e){var f,h,j,k=b.createElement("div");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:i+(d+1),k.appendChild(j);f=["&shy;","<style>",a,"</style>"].join(""),k.id=i,k.innerHTML+=f,g.appendChild(k),h=c(k,a),k.parentNode.removeChild(k);return!!h},w=function(b){if(a.matchMedia)return matchMedia(b).matches;var c;v("@media "+b+" { #"+i+" { position: absolute; } }",function(b){c=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle).position=="absolute"});return c},x=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=D(e[d],"function"),D(e[d],c)||(e[d]=c),e.removeAttribute(d))),e=null;return f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),y,z={}.hasOwnProperty,A;!D(z,c)&&!D(z.call,c)?A=function(a,b){return z.call(a,b)}:A=function(a,b){return b in a&&D(a.constructor.prototype[b],c)};var H=function(c,d){var f=c.join(""),g=d.length;v(f,function(c,d){var f=b.styleSheets[b.styleSheets.length-1],h=f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"",i=c.childNodes,j={};while(g--)j[i[g].id]=i[g];e.touch="ontouchstart"in a||j.touch.offsetTop===9,e.csstransforms3d=j.csstransforms3d.offsetLeft===9,e.generatedcontent=j.generatedcontent.offsetHeight>=1,e.fontface=/src/i.test(h)&&h.indexOf(d.split(" ")[0])===0},g,d)}(['@font-face {font-family:"font";src:url("https://")}',["@media (",o.join("touch-enabled),("),i,")","{#touch{top:9px;position:absolute}}"].join(""),["@media (",o.join("transform-3d),("),i,")","{#csstransforms3d{left:9px;position:absolute}}"].join(""),['#generatedcontent:after{content:"',m,'";visibility:hidden}'].join("")],["fontface","touch","csstransforms3d","generatedcontent"]);r.flexbox=function(){function c(a,b,c,d){a.style.cssText=o.join(b+":"+c+";")+(d||"")}function a(a,b,c,d){b+=":",a.style.cssText=(b+o.join(c+";"+b)).slice(0,-b.length)+(d||"")}var d=b.createElement("div"),e=b.createElement("div");a(d,"display","box","width:42px;padding:0;"),c(e,"box-flex","1","width:10px;"),d.appendChild(e),g.appendChild(d);var f=e.offsetWidth===42;d.removeChild(e),g.removeChild(d);return f},r.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},r.canvastext=function(){return!!e.canvas&&!!D(b.createElement("canvas").getContext("2d").fillText,"function")},r.webgl=function(){return!!a.WebGLRenderingContext},r.touch=function(){return e.touch},r.geolocation=function(){return!!navigator.geolocation},r.postmessage=function(){return!!a.postMessage},r.websqldatabase=function(){var b=!!a.openDatabase;return b},r.indexedDB=function(){for(var b=-1,c=p.length;++b<c;)if(a[p[b].toLowerCase()+"IndexedDB"])return!0;return!!a.indexedDB},r.hashchange=function(){return x("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},r.history=function(){return!!a.history&&!!history.pushState},r.draganddrop=function(){return x("dragstart")&&x("drop")},r.websockets=function(){for(var b=-1,c=p.length;++b<c;)if(a[p[b]+"WebSocket"])return!0;return"WebSocket"in a},r.rgba=function(){B("background-color:rgba(150,255,150,.5)");return E(k.backgroundColor,"rgba")},r.hsla=function(){B("background-color:hsla(120,40%,100%,.5)");return E(k.backgroundColor,"rgba")||E(k.backgroundColor,"hsla")},r.multiplebgs=function(){B("background:url(https://),url(https://),red url(https://)");return/(url\s*\(.*?){3}/.test(k.background)},r.backgroundsize=function(){return G("backgroundSize")},r.borderimage=function(){return G("borderImage")},r.borderradius=function(){return G("borderRadius")},r.boxshadow=function(){return G("boxShadow")},r.textshadow=function(){return b.createElement("div").style.textShadow===""},r.opacity=function(){C("opacity:.55");return/^0.55$/.test(k.opacity)},r.cssanimations=function(){return G("animationName")},r.csscolumns=function(){return G("columnCount")},r.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";B((a+o.join(b+a)+o.join(c+a)).slice(0,-a.length));return E(k.backgroundImage,"gradient")},r.cssreflections=function(){return G("boxReflect")},r.csstransforms=function(){return!!F(["transformProperty","WebkitTransform","MozTransform","OTransform","msTransform"])},r.csstransforms3d=function(){var a=!!F(["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"]);a&&"webkitPerspective"in g.style&&(a=e.csstransforms3d);return a},r.csstransitions=function(){return G("transitionProperty")},r.fontface=function(){return e.fontface},r.generatedcontent=function(){return e.generatedcontent},r.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType){c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"');var d='video/mp4; codecs="avc1.42E01E';c.h264=a.canPlayType(d+'"')||a.canPlayType(d+', mp4a.40.2"'),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"')}}catch(e){}return c},r.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"'),c.mp3=a.canPlayType("audio/mpeg;"),c.wav=a.canPlayType('audio/wav; codecs="1"'),c.m4a=a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")}catch(d){}return c},r.localstorage=function(){try{return!!localStorage.getItem}catch(a){return!1}},r.sessionstorage=function(){try{return!!sessionStorage.getItem}catch(a){return!1}},r.webworkers=function(){return!!a.Worker},r.applicationcache=function(){return!!a.applicationCache},r.svg=function(){return!!b.createElementNS&&!!b.createElementNS(q.svg,"svg").createSVGRect},r.inlinesvg=function(){var a=b.createElement("div");a.innerHTML="<svg/>";return(a.firstChild&&a.firstChild.namespaceURI)==q.svg},r.smil=function(){return!!b.createElementNS&&/SVG/.test(n.call(b.createElementNS(q.svg,"animate")))},r.svgclippaths=function(){return!!b.createElementNS&&/SVG/.test(n.call(b.createElementNS(q.svg,"clipPath")))};for(var J in r)A(r,J)&&(y=J.toLowerCase(),e[y]=r[J](),u.push((e[y]?"":"no-")+y));e.input||I(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)A(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return;b=typeof b=="boolean"?b:!!b(),g.className+=" "+(b?"":"no-")+a,e[a]=b}return e},B(""),j=l=null,a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML="<elem></elem>";return a.childNodes.length!==1}()&&function(a,b){function s(a){var b=-1;while(++b<g)a.createElement(f[b])}a.iepp=a.iepp||{};var d=a.iepp,e=d.html5elements||"abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",f=e.split("|"),g=f.length,h=new RegExp("(^|\\s)("+e+")","gi"),i=new RegExp("<(/*)("+e+")","gi"),j=/^\s*[\{\}]\s*$/,k=new RegExp("(^|[^\\n]*?\\s)("+e+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),l=b.createDocumentFragment(),m=b.documentElement,n=m.firstChild,o=b.createElement("body"),p=b.createElement("style"),q=/print|all/,r;d.getCSS=function(a,b){if(a+""===c)return"";var e=-1,f=a.length,g,h=[];while(++e<f){g=a[e];if(g.disabled)continue;b=g.media||b,q.test(b)&&h.push(d.getCSS(g.imports,b),g.cssText),b="all"}return h.join("")},d.parseCSS=function(a){var b=[],c;while((c=k.exec(a))!=null)b.push(((j.exec(c[1])?"\n":c[1])+c[2]+c[3]).replace(h,"$1.iepp_$2")+c[4]);return b.join("\n")},d.writeHTML=function(){var a=-1;r=r||b.body;while(++a<g){var c=b.getElementsByTagName(f[a]),d=c.length,e=-1;while(++e<d)c[e].className.indexOf("iepp_")<0&&(c[e].className+=" iepp_"+f[a])}l.appendChild(r),m.appendChild(o),o.className=r.className,o.id=r.id,o.innerHTML=r.innerHTML.replace(i,"<$1font")},d._beforePrint=function(){p.styleSheet.cssText=d.parseCSS(d.getCSS(b.styleSheets,"all")),d.writeHTML()},d.restoreHTML=function(){o.innerHTML="",m.removeChild(o),m.appendChild(r)},d._afterPrint=function(){d.restoreHTML(),p.styleSheet.cssText=""},s(b),s(l);d.disablePP||(n.insertBefore(p,n.firstChild),p.media="print",p.className="iepp-printshim",a.attachEvent("onbeforeprint",d._beforePrint),a.attachEvent("onafterprint",d._afterPrint))}(a,b),e._version=d,e._prefixes=o,e._domPrefixes=p,e.mq=w,e.hasEvent=x,e.testProp=function(a){return F([a])},e.testAllProps=G,e.testStyles=v,e.prefixed=function(a){return G(a,"pfx")},g.className=g.className.replace(/\bno-js\b/,"")+(f?" js "+u.join(" "):"");return e}(this,this.document),function(a,b){function u(){r(!0)}a.respond={},respond.update=function(){},respond.mediaQueriesSupported=b;if(!b){var c=a.document,d=c.documentElement,e=[],f=[],g=[],h={},i=30,j=c.getElementsByTagName("head")[0]||d,k=j.getElementsByTagName("link"),l=[],m=function(){var b=k,c=b.length,d=0,e,f,g,i;for(;d<c;d++)e=b[d],f=e.href,g=e.media,i=e.rel&&e.rel.toLowerCase()==="stylesheet",!!f&&i&&!h[f]&&(!/^([a-zA-Z]+?:(\/\/)?(www\.)?)/.test(f)||f.replace(RegExp.$1,"").split("/")[0]===a.location.host?l.push({href:f,media:g}):h[f]=!0);n()},n=function(){if(l.length){var a=l.shift();s(a.href,function(b){o(b,a.href,a.media),h[a.href]=!0,n()})}},o=function(a,b,c){var d=a.match(/@media[^\{]+\{([^\{\}]+\{[^\}\{]+\})+/gi),g=d&&d.length||0,b=b.substring(0,b.lastIndexOf("/")),h=function(a){return a.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+b+"$2$3")},i=!g&&c,j=0,k,l,m,n,o;b.length&&(b+="/"),i&&(g=1);for(;j<g;j++){k=0,i?(l=c,f.push(h(a))):(l=d[j].match(/@media ([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1,f.push(RegExp.$2&&h(RegExp.$2))),n=l.split(","),o=n.length;for(;k<o;k++)m=n[k],e.push({media:m.match(/(only\s+)?([a-zA-Z]+)(\sand)?/)&&RegExp.$2,rules:f.length-1,minw:m.match(/\(min\-width:[\s]*([\s]*[0-9]+)px[\s]*\)/)&&parseFloat(RegExp.$1),maxw:m.match(/\(max\-width:[\s]*([\s]*[0-9]+)px[\s]*\)/)&&parseFloat(RegExp.$1)})}r()},p,q,r=function(a){var b="clientWidth",h=d[b],l=c.compatMode==="CSS1Compat"&&h||c.body[b]||h,m={},n=c.createDocumentFragment(),o=k[k.length-1],s=(new Date).getTime();if(a&&p&&s-p<i)clearTimeout(q),q=setTimeout(r,i);else{p=s;for(var t in e){var u=e[t];if(!u.minw&&!u.maxw||(!u.minw||u.minw&&l>=u.minw)&&(!u.maxw||u.maxw&&l<=u.maxw))m[u.media]||(m[u.media]=[]),m[u.media].push(f[u.rules])}for(var t in g)g[t]&&g[t].parentNode===j&&j.removeChild(g[t]);for(var t in m){var v=c.createElement("style"),w=m[t].join("\n");v.type="text/css",v.media=t,v.styleSheet?v.styleSheet.cssText=w:v.appendChild(c.createTextNode(w)),n.appendChild(v),g.push(v)}j.insertBefore(n,o.nextSibling)}},s=function(a,b){var c=t();if(!!c){c.open("GET",a,!0),c.onreadystatechange=function(){c.readyState==4&&(c.status==200||c.status==304)&&b(c.responseText)};if(c.readyState==4)return;c.send()}},t=function(){var a=!1,b=[function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new XMLHttpRequest}],c=b.length;while(c--){try{a=b[c]()}catch(d){continue}break}return function(){return a}}();m(),respond.update=m,a.addEventListener?a.addEventListener("resize",u,!1):a.attachEvent&&a.attachEvent("onresize",u)}}(this,Modernizr.mq("only all")),function(a,b,c){function k(a){return!a||a=="loaded"||a=="complete"}function j(){var a=1,b=-1;while(p.length- ++b)if(p[b].s&&!(a=p[b].r))break;a&&g()}function i(a){var c=b.createElement("script"),d;c.src=a.s,c.onreadystatechange=c.onload=function(){!d&&k(c.readyState)&&(d=1,j(),c.onload=c.onreadystatechange=null)},m(function(){d||(d=1,j())},H.errorTimeout),a.e?c.onload():n.parentNode.insertBefore(c,n)}function h(a){var c=b.createElement("link"),d;c.href=a.s,c.rel="stylesheet",c.type="text/css";if(!a.e&&(w||r)){var e=function(a){m(function(){if(!d)try{a.sheet.cssRules.length?(d=1,j()):e(a)}catch(b){b.code==1e3||b.message=="security"||b.message=="denied"?(d=1,m(function(){j()},0)):e(a)}},0)};e(c)}else c.onload=function(){d||(d=1,m(function(){j()},0))},a.e&&c.onload();m(function(){d||(d=1,j())},H.errorTimeout),!a.e&&n.parentNode.insertBefore(c,n)}function g(){var a=p.shift();q=1,a?a.t?m(function(){a.t=="c"?h(a):i(a)},0):(a(),j()):q=0}function f(a,c,d,e,f,h){function i(){!o&&k(l.readyState)&&(r.r=o=1,!q&&j(),l.onload=l.onreadystatechange=null,m(function(){u.removeChild(l)},0))}var l=b.createElement(a),o=0,r={t:d,s:c,e:h};l.src=l.data=c,!s&&(l.style.display="none"),l.width=l.height="0",a!="object"&&(l.type=d),l.onload=l.onreadystatechange=i,a=="img"?l.onerror=i:a=="script"&&(l.onerror=function(){r.e=r.r=1,g()}),p.splice(e,0,r),u.insertBefore(l,s?null:n),m(function(){o||(u.removeChild(l),r.r=r.e=o=1,j())},H.errorTimeout)}function e(a,b,c){var d=b=="c"?z:y;q=0,b=b||"j",C(a)?f(d,a,b,this.i++,l,c):(p.splice(this.i++,0,a),p.length==1&&g());return this}function d(){var a=H;a.loader={load:e,i:0};return a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=r&&!s,u=s?l:n.parentNode,v=a.opera&&o.call(a.opera)=="[object Opera]",w="webkitAppearance"in l.style,x=w&&"async"in b.createElement("script"),y=r?"object":v||x?"img":"script",z=w?"img":y,A=Array.isArray||function(a){return o.call(a)=="[object Array]"},B=function(a){return Object(a)===a},C=function(a){return typeof a=="string"},D=function(a){return o.call(a)=="[object Function]"},E=[],F={},G,H;H=function(a){function f(a){var b=a.split("!"),c=E.length,d=b.pop(),e=b.length,f={url:d,origUrl:d,prefixes:b},g,h;for(h=0;h<e;h++)g=F[b[h]],g&&(f=g(f));for(h=0;h<c;h++)f=E[h](f);return f}function e(a,b,e,g,h){var i=f(a),j=i.autoCallback;if(!i.bypass){b&&(b=D(b)?b:b[a]||b[g]||b[a.split("/").pop().split("?")[0]]);if(i.instead)return i.instead(a,b,e,g,h);e.load(i.url,i.forceCSS||!i.forceJS&&/css$/.test(i.url)?"c":c,i.noexec),(D(b)||D(j))&&e.load(function(){d(),b&&b(i.origUrl,h,g),j&&j(i.origUrl,h,g)})}}function b(a,b){function c(a){if(C(a))e(a,h,b,0,d);else if(B(a))for(i in a)a.hasOwnProperty(i)&&e(a[i],h,b,i,d)}var d=!!a.test,f=d?a.yep:a.nope,g=a.load||a.both,h=a.callback,i;c(f),c(g),a.complete&&b.load(a.complete)}var g,h,i=this.yepnope.loader;if(C(a))e(a,0,i,0);else if(A(a))for(g=0;g<a.length;g++)h=a[g],C(h)?e(h,0,i,0):A(h)?H(h):B(h)&&b(h,i);else B(a)&&b(a,i)},H.addPrefix=function(a,b){F[a]=b},H.addFilter=function(a){E.push(a)},H.errorTimeout=1e4,b.readyState==null&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",G=function(){b.removeEventListener("DOMContentLoaded",G,0),b.readyState="complete"},0)),a.yepnope=d()}(this,this.document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};
8
+
9
+ /*
10
+ * Modernizr tests which native CSS3 and HTML5 features are available in
11
+ * the current UA and makes the results available to you in two ways:
12
+ * as properties on a global Modernizr object, and as classes on the
13
+ * <html> element. This information allows you to progressively enhance
14
+ * your pages with a granular level of control over the experience.
15
+ *
16
+ * Modernizr has an optional (not included) conditional resource loader
17
+ * called Modernizr.load(), based on Yepnope.js (yepnopejs.com).
18
+ * To get a build that includes Modernizr.load(), as well as choosing
19
+ * which tests to include, go to www.modernizr.com/download/
20
+ *
21
+ * Authors Faruk Ates, Paul Irish, Alex Sexton
22
+ * Contributors Ryan Seddon, Ben Alman
23
+ */
24
+
25
+ window.Modernizr = (function( window, document, undefined ) {
26
+
27
+ var version = '2.6.1',
28
+
29
+ Modernizr = {},
30
+
31
+ /*>>cssclasses*/
32
+ // option for enabling the HTML classes to be added
33
+ enableClasses = true,
34
+ /*>>cssclasses*/
35
+
36
+ docElement = document.documentElement,
37
+
38
+ /**
39
+ * Create our "modernizr" element that we do most feature tests on.
40
+ */
41
+ mod = 'modernizr',
42
+ modElem = document.createElement(mod),
43
+ mStyle = modElem.style,
44
+
45
+ /**
46
+ * Create the input element for various Web Forms feature tests.
47
+ */
48
+ inputElem /*>>inputelem*/ = document.createElement('input') /*>>inputelem*/ ,
49
+
50
+ /*>>smile*/
51
+ smile = ':)',
52
+ /*>>smile*/
53
+
54
+ toString = {}.toString,
55
+
56
+ // TODO :: make the prefixes more granular
57
+ /*>>prefixes*/
58
+ // List of property values to set for css tests. See ticket #21
59
+ prefixes = ' -webkit- -moz- -o- -ms- '.split(' '),
60
+ /*>>prefixes*/
61
+
62
+ /*>>domprefixes*/
63
+ // Following spec is to expose vendor-specific style properties as:
64
+ // elem.style.WebkitBorderRadius
65
+ // and the following would be incorrect:
66
+ // elem.style.webkitBorderRadius
67
+
68
+ // Webkit ghosts their properties in lowercase but Opera & Moz do not.
69
+ // Microsoft uses a lowercase `ms` instead of the correct `Ms` in IE8+
70
+ // erik.eae.net/archives/2008/03/10/21.48.10/
71
+
72
+ // More here: github.com/Modernizr/Modernizr/issues/issue/21
73
+ omPrefixes = 'Webkit Moz O ms',
74
+
75
+ cssomPrefixes = omPrefixes.split(' '),
76
+
77
+ domPrefixes = omPrefixes.toLowerCase().split(' '),
78
+ /*>>domprefixes*/
79
+
80
+ /*>>ns*/
81
+ ns = {'svg': 'http://www.w3.org/2000/svg'},
82
+ /*>>ns*/
83
+
84
+ tests = {},
85
+ inputs = {},
86
+ attrs = {},
87
+
88
+ classes = [],
89
+
90
+ slice = classes.slice,
91
+
92
+ featureName, // used in testing loop
93
+
94
+
95
+ /*>>teststyles*/
96
+ // Inject element with style element and some CSS rules
97
+ injectElementWithStyles = function( rule, callback, nodes, testnames ) {
98
+
99
+ var style, ret, node,
100
+ div = document.createElement('div'),
101
+ // After page load injecting a fake body doesn't work so check if body exists
102
+ body = document.body,
103
+ // IE6 and 7 won't return offsetWidth or offsetHeight unless it's in the body element, so we fake it.
104
+ fakeBody = body ? body : document.createElement('body');
105
+
106
+ if ( parseInt(nodes, 10) ) {
107
+ // In order not to give false positives we create a node for each test
108
+ // This also allows the method to scale for unspecified uses
109
+ while ( nodes-- ) {
110
+ node = document.createElement('div');
111
+ node.id = testnames ? testnames[nodes] : mod + (nodes + 1);
112
+ div.appendChild(node);
113
+ }
114
+ }
115
+
116
+ // <style> elements in IE6-9 are considered 'NoScope' elements and therefore will be removed
117
+ // when injected with innerHTML. To get around this you need to prepend the 'NoScope' element
118
+ // with a 'scoped' element, in our case the soft-hyphen entity as it won't mess with our measurements.
119
+ // msdn.microsoft.com/en-us/library/ms533897%28VS.85%29.aspx
120
+ // Documents served as xml will throw if using &shy; so use xml friendly encoded version. See issue #277
121
+ style = ['&#173;','<style id="s', mod, '">', rule, '</style>'].join('');
122
+ div.id = mod;
123
+ // IE6 will false positive on some tests due to the style element inside the test div somehow interfering offsetHeight, so insert it into body or fakebody.
124
+ // Opera will act all quirky when injecting elements in documentElement when page is served as xml, needs fakebody too. #270
125
+ (body ? div : fakeBody).innerHTML += style;
126
+ fakeBody.appendChild(div);
127
+ if ( !body ) {
128
+ //avoid crashing IE8, if background image is used
129
+ fakeBody.style.background = "";
130
+ docElement.appendChild(fakeBody);
131
+ }
132
+
133
+ ret = callback(div, rule);
134
+ // If this is done after page load we don't want to remove the body so check if body exists
135
+ !body ? fakeBody.parentNode.removeChild(fakeBody) : div.parentNode.removeChild(div);
136
+
137
+ return !!ret;
138
+
139
+ },
140
+ /*>>teststyles*/
141
+
142
+ /*>>mq*/
143
+ // adapted from matchMedia polyfill
144
+ // by Scott Jehl and Paul Irish
145
+ // gist.github.com/786768
146
+ testMediaQuery = function( mq ) {
147
+
148
+ var matchMedia = window.matchMedia || window.msMatchMedia;
149
+ if ( matchMedia ) {
150
+ return matchMedia(mq).matches;
151
+ }
152
+
153
+ var bool;
154
+
155
+ injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) {
156
+ bool = (window.getComputedStyle ?
157
+ getComputedStyle(node, null) :
158
+ node.currentStyle)['position'] == 'absolute';
159
+ });
160
+
161
+ return bool;
162
+
163
+ },
164
+ /*>>mq*/
165
+
166
+
167
+ /*>>hasevent*/
168
+ //
169
+ // isEventSupported determines if a given element supports the given event
170
+ // kangax.github.com/iseventsupported/
171
+ //
172
+ // The following results are known incorrects:
173
+ // Modernizr.hasEvent("webkitTransitionEnd", elem) // false negative
174
+ // Modernizr.hasEvent("textInput") // in Webkit. github.com/Modernizr/Modernizr/issues/333
175
+ // ...
176
+ isEventSupported = (function() {
177
+
178
+ var TAGNAMES = {
179
+ 'select': 'input', 'change': 'input',
180
+ 'submit': 'form', 'reset': 'form',
181
+ 'error': 'img', 'load': 'img', 'abort': 'img'
182
+ };
183
+
184
+ function isEventSupported( eventName, element ) {
185
+
186
+ element = element || document.createElement(TAGNAMES[eventName] || 'div');
187
+ eventName = 'on' + eventName;
188
+
189
+ // When using `setAttribute`, IE skips "unload", WebKit skips "unload" and "resize", whereas `in` "catches" those
190
+ var isSupported = eventName in element;
191
+
192
+ if ( !isSupported ) {
193
+ // If it has no `setAttribute` (i.e. doesn't implement Node interface), try generic element
194
+ if ( !element.setAttribute ) {
195
+ element = document.createElement('div');
196
+ }
197
+ if ( element.setAttribute && element.removeAttribute ) {
198
+ element.setAttribute(eventName, '');
199
+ isSupported = is(element[eventName], 'function');
200
+
201
+ // If property was created, "remove it" (by setting value to `undefined`)
202
+ if ( !is(element[eventName], 'undefined') ) {
203
+ element[eventName] = undefined;
204
+ }
205
+ element.removeAttribute(eventName);
206
+ }
207
+ }
208
+
209
+ element = null;
210
+ return isSupported;
211
+ }
212
+ return isEventSupported;
213
+ })(),
214
+ /*>>hasevent*/
215
+
216
+ // TODO :: Add flag for hasownprop ? didn't last time
217
+
218
+ // hasOwnProperty shim by kangax needed for Safari 2.0 support
219
+ _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;
220
+
221
+ if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) {
222
+ hasOwnProp = function (object, property) {
223
+ return _hasOwnProperty.call(object, property);
224
+ };
225
+ }
226
+ else {
227
+ hasOwnProp = function (object, property) { /* yes, this can give false positives/negatives, but most of the time we don't care about those */
228
+ return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
229
+ };
230
+ }
231
+
232
+ // Adapted from ES5-shim https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js
233
+ // es5.github.com/#x15.3.4.5
234
+
235
+ if (!Function.prototype.bind) {
236
+ Function.prototype.bind = function bind(that) {
237
+
238
+ var target = this;
239
+
240
+ if (typeof target != "function") {
241
+ throw new TypeError();
242
+ }
243
+
244
+ var args = slice.call(arguments, 1),
245
+ bound = function () {
246
+
247
+ if (this instanceof bound) {
248
+
249
+ var F = function(){};
250
+ F.prototype = target.prototype;
251
+ var self = new F();
252
+
253
+ var result = target.apply(
254
+ self,
255
+ args.concat(slice.call(arguments))
256
+ );
257
+ if (Object(result) === result) {
258
+ return result;
259
+ }
260
+ return self;
261
+
262
+ } else {
263
+
264
+ return target.apply(
265
+ that,
266
+ args.concat(slice.call(arguments))
267
+ );
268
+
269
+ }
270
+
271
+ };
272
+
273
+ return bound;
274
+ };
275
+ }
276
+
277
+ /**
278
+ * setCss applies given styles to the Modernizr DOM node.
279
+ */
280
+ function setCss( str ) {
281
+ mStyle.cssText = str;
282
+ }
283
+
284
+ /**
285
+ * setCssAll extrapolates all vendor-specific css strings.
286
+ */
287
+ function setCssAll( str1, str2 ) {
288
+ return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
289
+ }
290
+
291
+ /**
292
+ * is returns a boolean for if typeof obj is exactly type.
293
+ */
294
+ function is( obj, type ) {
295
+ return typeof obj === type;
296
+ }
297
+
298
+ /**
299
+ * contains returns a boolean for if substr is found within str.
300
+ */
301
+ function contains( str, substr ) {
302
+ return !!~('' + str).indexOf(substr);
303
+ }
304
+
305
+ /*>>testprop*/
306
+
307
+ // testProps is a generic CSS / DOM property test.
308
+
309
+ // In testing support for a given CSS property, it's legit to test:
310
+ // `elem.style[styleName] !== undefined`
311
+ // If the property is supported it will return an empty string,
312
+ // if unsupported it will return undefined.
313
+
314
+ // We'll take advantage of this quick test and skip setting a style
315
+ // on our modernizr element, but instead just testing undefined vs
316
+ // empty string.
317
+
318
+ // Because the testing of the CSS property names (with "-", as
319
+ // opposed to the camelCase DOM properties) is non-portable and
320
+ // non-standard but works in WebKit and IE (but not Gecko or Opera),
321
+ // we explicitly reject properties with dashes so that authors
322
+ // developing in WebKit or IE first don't end up with
323
+ // browser-specific content by accident.
324
+
325
+ function testProps( props, prefixed ) {
326
+ for ( var i in props ) {
327
+ var prop = props[i];
328
+ if ( !contains(prop, "-") && mStyle[prop] !== undefined ) {
329
+ return prefixed == 'pfx' ? prop : true;
330
+ }
331
+ }
332
+ return false;
333
+ }
334
+ /*>>testprop*/
335
+
336
+ // TODO :: add testDOMProps
337
+ /**
338
+ * testDOMProps is a generic DOM property test; if a browser supports
339
+ * a certain property, it won't return undefined for it.
340
+ */
341
+ function testDOMProps( props, obj, elem ) {
342
+ for ( var i in props ) {
343
+ var item = obj[props[i]];
344
+ if ( item !== undefined) {
345
+
346
+ // return the property name as a string
347
+ if (elem === false) return props[i];
348
+
349
+ // let's bind a function
350
+ if (is(item, 'function')){
351
+ // default to autobind unless override
352
+ return item.bind(elem || obj);
353
+ }
354
+
355
+ // return the unbound function or obj or value
356
+ return item;
357
+ }
358
+ }
359
+ return false;
360
+ }
361
+
362
+ /*>>testallprops*/
363
+ /**
364
+ * testPropsAll tests a list of DOM properties we want to check against.
365
+ * We specify literally ALL possible (known and/or likely) properties on
366
+ * the element including the non-vendor prefixed one, for forward-
367
+ * compatibility.
368
+ */
369
+ function testPropsAll( prop, prefixed, elem ) {
370
+
371
+ var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1),
372
+ props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');
373
+
374
+ // did they call .prefixed('boxSizing') or are we just testing a prop?
375
+ if(is(prefixed, "string") || is(prefixed, "undefined")) {
376
+ return testProps(props, prefixed);
377
+
378
+ // otherwise, they called .prefixed('requestAnimationFrame', window[, elem])
379
+ } else {
380
+ props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');
381
+ return testDOMProps(props, prefixed, elem);
382
+ }
383
+ }
384
+ /*>>testallprops*/
385
+
386
+
387
+ /**
388
+ * Tests
389
+ * -----
390
+ */
391
+
392
+ // The *new* flexbox
393
+ // dev.w3.org/csswg/css3-flexbox
394
+
395
+ tests['flexbox'] = function() {
396
+ return testPropsAll('flexWrap');
397
+ };
398
+
399
+ // The *old* flexbox
400
+ // www.w3.org/TR/2009/WD-css3-flexbox-20090723/
401
+
402
+ tests['flexboxlegacy'] = function() {
403
+ return testPropsAll('boxDirection');
404
+ };
405
+
406
+ // On the S60 and BB Storm, getContext exists, but always returns undefined
407
+ // so we actually have to call getContext() to verify
408
+ // github.com/Modernizr/Modernizr/issues/issue/97/
409
+
410
+ tests['canvas'] = function() {
411
+ var elem = document.createElement('canvas');
412
+ return !!(elem.getContext && elem.getContext('2d'));
413
+ };
414
+
415
+ tests['canvastext'] = function() {
416
+ return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function'));
417
+ };
418
+
419
+ // webk.it/70117 is tracking a legit WebGL feature detect proposal
420
+
421
+ // We do a soft detect which may false positive in order to avoid
422
+ // an expensive context creation: bugzil.la/732441
423
+
424
+ tests['webgl'] = function() {
425
+ return !!window.WebGLRenderingContext;
426
+ };
427
+
428
+ /*
429
+ * The Modernizr.touch test only indicates if the browser supports
430
+ * touch events, which does not necessarily reflect a touchscreen
431
+ * device, as evidenced by tablets running Windows 7 or, alas,
432
+ * the Palm Pre / WebOS (touch) phones.
433
+ *
434
+ * Additionally, Chrome (desktop) used to lie about its support on this,
435
+ * but that has since been rectified: crbug.com/36415
436
+ *
437
+ * We also test for Firefox 4 Multitouch Support.
438
+ *
439
+ * For more info, see: modernizr.github.com/Modernizr/touch.html
440
+ */
441
+
442
+ tests['touch'] = function() {
443
+ var bool;
444
+
445
+ if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
446
+ bool = true;
447
+ } else {
448
+ injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) {
449
+ bool = node.offsetTop === 9;
450
+ });
451
+ }
452
+
453
+ return bool;
454
+ };
455
+
456
+
457
+ // geolocation is often considered a trivial feature detect...
458
+ // Turns out, it's quite tricky to get right:
459
+ //
460
+ // Using !!navigator.geolocation does two things we don't want. It:
461
+ // 1. Leaks memory in IE9: github.com/Modernizr/Modernizr/issues/513
462
+ // 2. Disables page caching in WebKit: webk.it/43956
463
+ //
464
+ // Meanwhile, in Firefox < 8, an about:config setting could expose
465
+ // a false positive that would throw an exception: bugzil.la/688158
466
+
467
+ tests['geolocation'] = function() {
468
+ return 'geolocation' in navigator;
469
+ };
470
+
471
+
472
+ tests['postmessage'] = function() {
473
+ return !!window.postMessage;
474
+ };
475
+
476
+
477
+ // Chrome incognito mode used to throw an exception when using openDatabase
478
+ // It doesn't anymore.
479
+ tests['websqldatabase'] = function() {
480
+ return !!window.openDatabase;
481
+ };
482
+
483
+ // Vendors had inconsistent prefixing with the experimental Indexed DB:
484
+ // - Webkit's implementation is accessible through webkitIndexedDB
485
+ // - Firefox shipped moz_indexedDB before FF4b9, but since then has been mozIndexedDB
486
+ // For speed, we don't test the legacy (and beta-only) indexedDB
487
+ tests['indexedDB'] = function() {
488
+ return !!testPropsAll("indexedDB", window);
489
+ };
490
+
491
+ // documentMode logic from YUI to filter out IE8 Compat Mode
492
+ // which false positives.
493
+ tests['hashchange'] = function() {
494
+ return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7);
495
+ };
496
+
497
+ // Per 1.6:
498
+ // This used to be Modernizr.historymanagement but the longer
499
+ // name has been deprecated in favor of a shorter and property-matching one.
500
+ // The old API is still available in 1.6, but as of 2.0 will throw a warning,
501
+ // and in the first release thereafter disappear entirely.
502
+ tests['history'] = function() {
503
+ return !!(window.history && history.pushState);
504
+ };
505
+
506
+ tests['draganddrop'] = function() {
507
+ var div = document.createElement('div');
508
+ return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div);
509
+ };
510
+
511
+ // FF3.6 was EOL'ed on 4/24/12, but the ESR version of FF10
512
+ // will be supported until FF19 (2/12/13), at which time, ESR becomes FF17.
513
+ // FF10 still uses prefixes, so check for it until then.
514
+ // for more ESR info, see: mozilla.org/en-US/firefox/organizations/faq/
515
+ tests['websockets'] = function() {
516
+ return 'WebSocket' in window || 'MozWebSocket' in window;
517
+ };
518
+
519
+
520
+ // css-tricks.com/rgba-browser-support/
521
+ tests['rgba'] = function() {
522
+ // Set an rgba() color and check the returned value
523
+
524
+ setCss('background-color:rgba(150,255,150,.5)');
525
+
526
+ return contains(mStyle.backgroundColor, 'rgba');
527
+ };
528
+
529
+ tests['hsla'] = function() {
530
+ // Same as rgba(), in fact, browsers re-map hsla() to rgba() internally,
531
+ // except IE9 who retains it as hsla
532
+
533
+ setCss('background-color:hsla(120,40%,100%,.5)');
534
+
535
+ return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla');
536
+ };
537
+
538
+ tests['multiplebgs'] = function() {
539
+ // Setting multiple images AND a color on the background shorthand property
540
+ // and then querying the style.background property value for the number of
541
+ // occurrences of "url(" is a reliable method for detecting ACTUAL support for this!
542
+
543
+ setCss('background:url(https://),url(https://),red url(https://)');
544
+
545
+ // If the UA supports multiple backgrounds, there should be three occurrences
546
+ // of the string "url(" in the return value for elemStyle.background
547
+
548
+ return (/(url\s*\(.*?){3}/).test(mStyle.background);
549
+ };
550
+
551
+
552
+
553
+ // this will false positive in Opera Mini
554
+ // github.com/Modernizr/Modernizr/issues/396
555
+
556
+ tests['backgroundsize'] = function() {
557
+ return testPropsAll('backgroundSize');
558
+ };
559
+
560
+ tests['borderimage'] = function() {
561
+ return testPropsAll('borderImage');
562
+ };
563
+
564
+
565
+ // Super comprehensive table about all the unique implementations of
566
+ // border-radius: muddledramblings.com/table-of-css3-border-radius-compliance
567
+
568
+ tests['borderradius'] = function() {
569
+ return testPropsAll('borderRadius');
570
+ };
571
+
572
+ // WebOS unfortunately false positives on this test.
573
+ tests['boxshadow'] = function() {
574
+ return testPropsAll('boxShadow');
575
+ };
576
+
577
+ // FF3.0 will false positive on this test
578
+ tests['textshadow'] = function() {
579
+ return document.createElement('div').style.textShadow === '';
580
+ };
581
+
582
+
583
+ tests['opacity'] = function() {
584
+ // Browsers that actually have CSS Opacity implemented have done so
585
+ // according to spec, which means their return values are within the
586
+ // range of [0.0,1.0] - including the leading zero.
587
+
588
+ setCssAll('opacity:.55');
589
+
590
+ // The non-literal . in this regex is intentional:
591
+ // German Chrome returns this value as 0,55
592
+ // github.com/Modernizr/Modernizr/issues/#issue/59/comment/516632
593
+ return (/^0.55$/).test(mStyle.opacity);
594
+ };
595
+
596
+
597
+ // Note, Android < 4 will pass this test, but can only animate
598
+ // a single property at a time
599
+ // daneden.me/2011/12/putting-up-with-androids-bullshit/
600
+ tests['cssanimations'] = function() {
601
+ return testPropsAll('animationName');
602
+ };
603
+
604
+
605
+ tests['csscolumns'] = function() {
606
+ return testPropsAll('columnCount');
607
+ };
608
+
609
+
610
+ tests['cssgradients'] = function() {
611
+ /**
612
+ * For CSS Gradients syntax, please see:
613
+ * webkit.org/blog/175/introducing-css-gradients/
614
+ * developer.mozilla.org/en/CSS/-moz-linear-gradient
615
+ * developer.mozilla.org/en/CSS/-moz-radial-gradient
616
+ * dev.w3.org/csswg/css3-images/#gradients-
617
+ */
618
+
619
+ var str1 = 'background-image:',
620
+ str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));',
621
+ str3 = 'linear-gradient(left top,#9f9, white);';
622
+
623
+ setCss(
624
+ // legacy webkit syntax (FIXME: remove when syntax not in use anymore)
625
+ (str1 + '-webkit- '.split(' ').join(str2 + str1) +
626
+ // standard syntax // trailing 'background-image:'
627
+ prefixes.join(str3 + str1)).slice(0, -str1.length)
628
+ );
629
+
630
+ return contains(mStyle.backgroundImage, 'gradient');
631
+ };
632
+
633
+
634
+ tests['cssreflections'] = function() {
635
+ return testPropsAll('boxReflect');
636
+ };
637
+
638
+
639
+ tests['csstransforms'] = function() {
640
+ return !!testPropsAll('transform');
641
+ };
642
+
643
+
644
+ tests['csstransforms3d'] = function() {
645
+
646
+ var ret = !!testPropsAll('perspective');
647
+
648
+ // Webkit's 3D transforms are passed off to the browser's own graphics renderer.
649
+ // It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in
650
+ // some conditions. As a result, Webkit typically recognizes the syntax but
651
+ // will sometimes throw a false positive, thus we must do a more thorough check:
652
+ if ( ret && 'webkitPerspective' in docElement.style ) {
653
+
654
+ // Webkit allows this media query to succeed only if the feature is enabled.
655
+ // `@media (transform-3d),(-webkit-transform-3d){ ... }`
656
+ injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) {
657
+ ret = node.offsetLeft === 9 && node.offsetHeight === 3;
658
+ });
659
+ }
660
+ return ret;
661
+ };
662
+
663
+
664
+ tests['csstransitions'] = function() {
665
+ return testPropsAll('transition');
666
+ };
667
+
668
+
669
+ /*>>fontface*/
670
+ // @font-face detection routine by Diego Perini
671
+ // javascript.nwbox.com/CSSSupport/
672
+
673
+ // false positives:
674
+ // WebOS github.com/Modernizr/Modernizr/issues/342
675
+ // WP7 github.com/Modernizr/Modernizr/issues/538
676
+ tests['fontface'] = function() {
677
+ var bool;
678
+
679
+ injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function( node, rule ) {
680
+ var style = document.getElementById('smodernizr'),
681
+ sheet = style.sheet || style.styleSheet,
682
+ cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : '';
683
+
684
+ bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0;
685
+ });
686
+
687
+ return bool;
688
+ };
689
+ /*>>fontface*/
690
+
691
+ // CSS generated content detection
692
+ tests['generatedcontent'] = function() {
693
+ var bool;
694
+
695
+ injectElementWithStyles(['#modernizr:after{content:"',smile,'";visibility:hidden}'].join(''), function( node ) {
696
+ bool = node.offsetHeight >= 1;
697
+ });
698
+
699
+ return bool;
700
+ };
701
+
702
+
703
+
704
+ // These tests evaluate support of the video/audio elements, as well as
705
+ // testing what types of content they support.
706
+ //
707
+ // We're using the Boolean constructor here, so that we can extend the value
708
+ // e.g. Modernizr.video // true
709
+ // Modernizr.video.ogg // 'probably'
710
+ //
711
+ // Codec values from : github.com/NielsLeenheer/html5test/blob/9106a8/index.html#L845
712
+ // thx to NielsLeenheer and zcorpan
713
+
714
+ // Note: in some older browsers, "no" was a return value instead of empty string.
715
+ // It was live in FF3.5.0 and 3.5.1, but fixed in 3.5.2
716
+ // It was also live in Safari 4.0.0 - 4.0.4, but fixed in 4.0.5
717
+
718
+ tests['video'] = function() {
719
+ var elem = document.createElement('video'),
720
+ bool = false;
721
+
722
+ // IE9 Running on Windows Server SKU can cause an exception to be thrown, bug #224
723
+ try {
724
+ if ( bool = !!elem.canPlayType ) {
725
+ bool = new Boolean(bool);
726
+ bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,'');
727
+
728
+ // Without QuickTime, this value will be `undefined`. github.com/Modernizr/Modernizr/issues/546
729
+ bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,'');
730
+
731
+ bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,'');
732
+ }
733
+
734
+ } catch(e) { }
735
+
736
+ return bool;
737
+ };
738
+
739
+ tests['audio'] = function() {
740
+ var elem = document.createElement('audio'),
741
+ bool = false;
742
+
743
+ try {
744
+ if ( bool = !!elem.canPlayType ) {
745
+ bool = new Boolean(bool);
746
+ bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,'');
747
+ bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,'');
748
+
749
+ // Mimetypes accepted:
750
+ // developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements
751
+ // bit.ly/iphoneoscodecs
752
+ bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,'');
753
+ bool.m4a = ( elem.canPlayType('audio/x-m4a;') ||
754
+ elem.canPlayType('audio/aac;')) .replace(/^no$/,'');
755
+ }
756
+ } catch(e) { }
757
+
758
+ return bool;
759
+ };
760
+
761
+
762
+ // In FF4, if disabled, window.localStorage should === null.
763
+
764
+ // Normally, we could not test that directly and need to do a
765
+ // `('localStorage' in window) && ` test first because otherwise Firefox will
766
+ // throw bugzil.la/365772 if cookies are disabled
767
+
768
+ // Also in iOS5 Private Browsing mode, attempting to use localStorage.setItem
769
+ // will throw the exception:
770
+ // QUOTA_EXCEEDED_ERRROR DOM Exception 22.
771
+ // Peculiarly, getItem and removeItem calls do not throw.
772
+
773
+ // Because we are forced to try/catch this, we'll go aggressive.
774
+
775
+ // Just FWIW: IE8 Compat mode supports these features completely:
776
+ // www.quirksmode.org/dom/html5.html
777
+ // But IE8 doesn't support either with local files
778
+
779
+ tests['localstorage'] = function() {
780
+ try {
781
+ localStorage.setItem(mod, mod);
782
+ localStorage.removeItem(mod);
783
+ return true;
784
+ } catch(e) {
785
+ return false;
786
+ }
787
+ };
788
+
789
+ tests['sessionstorage'] = function() {
790
+ try {
791
+ sessionStorage.setItem(mod, mod);
792
+ sessionStorage.removeItem(mod);
793
+ return true;
794
+ } catch(e) {
795
+ return false;
796
+ }
797
+ };
798
+
799
+
800
+ tests['webworkers'] = function() {
801
+ return !!window.Worker;
802
+ };
803
+
804
+
805
+ tests['applicationcache'] = function() {
806
+ return !!window.applicationCache;
807
+ };
808
+
809
+
810
+ // Thanks to Erik Dahlstrom
811
+ tests['svg'] = function() {
812
+ return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect;
813
+ };
814
+
815
+ // specifically for SVG inline in HTML, not within XHTML
816
+ // test page: paulirish.com/demo/inline-svg
817
+ tests['inlinesvg'] = function() {
818
+ var div = document.createElement('div');
819
+ div.innerHTML = '<svg/>';
820
+ return (div.firstChild && div.firstChild.namespaceURI) == ns.svg;
821
+ };
822
+
823
+ // SVG SMIL animation
824
+ tests['smil'] = function() {
825
+ return !!document.createElementNS && /SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate')));
826
+ };
827
+
828
+ // This test is only for clip paths in SVG proper, not clip paths on HTML content
829
+ // demo: srufaculty.sru.edu/david.dailey/svg/newstuff/clipPath4.svg
830
+
831
+ // However read the comments to dig into applying SVG clippaths to HTML content here:
832
+ // github.com/Modernizr/Modernizr/issues/213#issuecomment-1149491
833
+ tests['svgclippaths'] = function() {
834
+ return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath')));
835
+ };
836
+
837
+ /*>>webforms*/
838
+ // input features and input types go directly onto the ret object, bypassing the tests loop.
839
+ // Hold this guy to execute in a moment.
840
+ function webforms() {
841
+ /*>>input*/
842
+ // Run through HTML5's new input attributes to see if the UA understands any.
843
+ // We're using f which is the <input> element created early on
844
+ // Mike Taylr has created a comprehensive resource for testing these attributes
845
+ // when applied to all input types:
846
+ // miketaylr.com/code/input-type-attr.html
847
+ // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
848
+
849
+ // Only input placeholder is tested while textarea's placeholder is not.
850
+ // Currently Safari 4 and Opera 11 have support only for the input placeholder
851
+ // Both tests are available in feature-detects/forms-placeholder.js
852
+ Modernizr['input'] = (function( props ) {
853
+ for ( var i = 0, len = props.length; i < len; i++ ) {
854
+ attrs[ props[i] ] = !!(props[i] in inputElem);
855
+ }
856
+ if (attrs.list){
857
+ // safari false positive's on datalist: webk.it/74252
858
+ // see also github.com/Modernizr/Modernizr/issues/146
859
+ attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);
860
+ }
861
+ return attrs;
862
+ })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));
863
+ /*>>input*/
864
+
865
+ /*>>inputtypes*/
866
+ // Run through HTML5's new input types to see if the UA understands any.
867
+ // This is put behind the tests runloop because it doesn't return a
868
+ // true/false like all the other tests; instead, it returns an object
869
+ // containing each input type with its corresponding true/false value
870
+
871
+ // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/
872
+ Modernizr['inputtypes'] = (function(props) {
873
+
874
+ for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {
875
+
876
+ inputElem.setAttribute('type', inputElemType = props[i]);
877
+ bool = inputElem.type !== 'text';
878
+
879
+ // We first check to see if the type we give it sticks..
880
+ // If the type does, we feed it a textual value, which shouldn't be valid.
881
+ // If the value doesn't stick, we know there's input sanitization which infers a custom UI
882
+ if ( bool ) {
883
+
884
+ inputElem.value = smile;
885
+ inputElem.style.cssText = 'position:absolute;visibility:hidden;';
886
+
887
+ if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {
888
+
889
+ docElement.appendChild(inputElem);
890
+ defaultView = document.defaultView;
891
+
892
+ // Safari 2-4 allows the smiley as a value, despite making a slider
893
+ bool = defaultView.getComputedStyle &&
894
+ defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&
895
+ // Mobile android web browser has false positive, so must
896
+ // check the height to see if the widget is actually there.
897
+ (inputElem.offsetHeight !== 0);
898
+
899
+ docElement.removeChild(inputElem);
900
+
901
+ } else if ( /^(search|tel)$/.test(inputElemType) ){
902
+ // Spec doesn't define any special parsing or detectable UI
903
+ // behaviors so we pass these through as true
904
+
905
+ // Interestingly, opera fails the earlier test, so it doesn't
906
+ // even make it here.
907
+
908
+ } else if ( /^(url|email)$/.test(inputElemType) ) {
909
+ // Real url and email support comes with prebaked validation.
910
+ bool = inputElem.checkValidity && inputElem.checkValidity() === false;
911
+
912
+ } else {
913
+ // If the upgraded input compontent rejects the :) text, we got a winner
914
+ bool = inputElem.value != smile;
915
+ }
916
+ }
917
+
918
+ inputs[ props[i] ] = !!bool;
919
+ }
920
+ return inputs;
921
+ })('search tel url email datetime date month week time datetime-local number range color'.split(' '));
922
+ /*>>inputtypes*/
923
+ }
924
+ /*>>webforms*/
925
+
926
+
927
+ // End of test definitions
928
+ // -----------------------
929
+
930
+
931
+
932
+ // Run through all tests and detect their support in the current UA.
933
+ // todo: hypothetically we could be doing an array of tests and use a basic loop here.
934
+ for ( var feature in tests ) {
935
+ if ( hasOwnProp(tests, feature) ) {
936
+ // run the test, throw the return value into the Modernizr,
937
+ // then based on that boolean, define an appropriate className
938
+ // and push it into an array of classes we'll join later.
939
+ featureName = feature.toLowerCase();
940
+ Modernizr[featureName] = tests[feature]();
941
+
942
+ classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
943
+ }
944
+ }
945
+
946
+ /*>>webforms*/
947
+ // input tests need to run.
948
+ Modernizr.input || webforms();
949
+ /*>>webforms*/
950
+
951
+
952
+ /**
953
+ * addTest allows the user to define their own feature tests
954
+ * the result will be added onto the Modernizr object,
955
+ * as well as an appropriate className set on the html element
956
+ *
957
+ * @param feature - String naming the feature
958
+ * @param test - Function returning true if feature is supported, false if not
959
+ */
960
+ Modernizr.addTest = function ( feature, test ) {
961
+ if ( typeof feature == 'object' ) {
962
+ for ( var key in feature ) {
963
+ if ( hasOwnProp( feature, key ) ) {
964
+ Modernizr.addTest( key, feature[ key ] );
965
+ }
966
+ }
967
+ } else {
968
+
969
+ feature = feature.toLowerCase();
970
+
971
+ if ( Modernizr[feature] !== undefined ) {
972
+ // we're going to quit if you're trying to overwrite an existing test
973
+ // if we were to allow it, we'd do this:
974
+ // var re = new RegExp("\\b(no-)?" + feature + "\\b");
975
+ // docElement.className = docElement.className.replace( re, '' );
976
+ // but, no rly, stuff 'em.
977
+ return Modernizr;
978
+ }
979
+
980
+ test = typeof test == 'function' ? test() : test;
981
+
982
+ if (enableClasses) {
983
+ docElement.className += ' ' + (test ? '' : 'no-') + feature;
984
+ }
985
+ Modernizr[feature] = test;
986
+
987
+ }
988
+
989
+ return Modernizr; // allow chaining.
990
+ };
991
+
992
+
993
+ // Reset modElem.cssText to nothing to reduce memory footprint.
994
+ setCss('');
995
+ modElem = inputElem = null;
996
+
997
+ /*>>shiv*/
998
+ /*! HTML5 Shiv v3.6 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed */
999
+ ;(function(window, document) {
1000
+ /*jshint evil:true */
1001
+ /** Preset options */
1002
+ var options = window.html5 || {};
1003
+
1004
+ /** Used to skip problem elements */
1005
+ var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
1006
+
1007
+ /** Not all elements can be cloned in IE (this list can be shortend) **/
1008
+ var saveClones = /^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i;
1009
+
1010
+ /** Detect whether the browser supports default html5 styles */
1011
+ var supportsHtml5Styles;
1012
+
1013
+ /** Name of the expando, to work with multiple documents or to re-shiv one document */
1014
+ var expando = '_html5shiv';
1015
+
1016
+ /** The id for the the documents expando */
1017
+ var expanID = 0;
1018
+
1019
+ /** Cached data for each document */
1020
+ var expandoData = {};
1021
+
1022
+ /** Detect whether the browser supports unknown elements */
1023
+ var supportsUnknownElements;
1024
+
1025
+ (function() {
1026
+ try {
1027
+ var a = document.createElement('a');
1028
+ a.innerHTML = '<xyz></xyz>';
1029
+ //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles
1030
+ supportsHtml5Styles = ('hidden' in a);
1031
+
1032
+ supportsUnknownElements = a.childNodes.length == 1 || (function() {
1033
+ // assign a false positive if unable to shiv
1034
+ (document.createElement)('a');
1035
+ var frag = document.createDocumentFragment();
1036
+ return (
1037
+ typeof frag.cloneNode == 'undefined' ||
1038
+ typeof frag.createDocumentFragment == 'undefined' ||
1039
+ typeof frag.createElement == 'undefined'
1040
+ );
1041
+ }());
1042
+ } catch(e) {
1043
+ supportsHtml5Styles = true;
1044
+ supportsUnknownElements = true;
1045
+ }
1046
+
1047
+ }());
1048
+
1049
+ /*--------------------------------------------------------------------------*/
1050
+
1051
+ /**
1052
+ * Creates a style sheet with the given CSS text and adds it to the document.
1053
+ * @private
1054
+ * @param {Document} ownerDocument The document.
1055
+ * @param {String} cssText The CSS text.
1056
+ * @returns {StyleSheet} The style element.
1057
+ */
1058
+ function addStyleSheet(ownerDocument, cssText) {
1059
+ var p = ownerDocument.createElement('p'),
1060
+ parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
1061
+
1062
+ p.innerHTML = 'x<style>' + cssText + '</style>';
1063
+ return parent.insertBefore(p.lastChild, parent.firstChild);
1064
+ }
1065
+
1066
+ /**
1067
+ * Returns the value of `html5.elements` as an array.
1068
+ * @private
1069
+ * @returns {Array} An array of shived element node names.
1070
+ */
1071
+ function getElements() {
1072
+ var elements = html5.elements;
1073
+ return typeof elements == 'string' ? elements.split(' ') : elements;
1074
+ }
1075
+
1076
+ /**
1077
+ * Returns the data associated to the given document
1078
+ * @private
1079
+ * @param {Document} ownerDocument The document.
1080
+ * @returns {Object} An object of data.
1081
+ */
1082
+ function getExpandoData(ownerDocument) {
1083
+ var data = expandoData[ownerDocument[expando]];
1084
+ if (!data) {
1085
+ data = {};
1086
+ expanID++;
1087
+ ownerDocument[expando] = expanID;
1088
+ expandoData[expanID] = data;
1089
+ }
1090
+ return data;
1091
+ }
1092
+
1093
+ /**
1094
+ * returns a shived element for the given nodeName and document
1095
+ * @memberOf html5
1096
+ * @param {String} nodeName name of the element
1097
+ * @param {Document} ownerDocument The context document.
1098
+ * @returns {Object} The shived element.
1099
+ */
1100
+ function createElement(nodeName, ownerDocument, data){
1101
+ if (!ownerDocument) {
1102
+ ownerDocument = document;
1103
+ }
1104
+ if(supportsUnknownElements){
1105
+ return ownerDocument.createElement(nodeName);
1106
+ }
1107
+ if (!data) {
1108
+ data = getExpandoData(ownerDocument);
1109
+ }
1110
+ var node;
1111
+
1112
+ if (data.cache[nodeName]) {
1113
+ node = data.cache[nodeName].cloneNode();
1114
+ } else if (saveClones.test(nodeName)) {
1115
+ node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
1116
+ } else {
1117
+ node = data.createElem(nodeName);
1118
+ }
1119
+
1120
+ // Avoid adding some elements to fragments in IE < 9 because
1121
+ // * Attributes like `name` or `type` cannot be set/changed once an element
1122
+ // is inserted into a document/fragment
1123
+ // * Link elements with `src` attributes that are inaccessible, as with
1124
+ // a 403 response, will cause the tab/window to crash
1125
+ // * Script elements appended to fragments will execute when their `src`
1126
+ // or `text` property is set
1127
+ return node.canHaveChildren && !reSkip.test(nodeName) ? data.frag.appendChild(node) : node;
1128
+ }
1129
+
1130
+ /**
1131
+ * returns a shived DocumentFragment for the given document
1132
+ * @memberOf html5
1133
+ * @param {Document} ownerDocument The context document.
1134
+ * @returns {Object} The shived DocumentFragment.
1135
+ */
1136
+ function createDocumentFragment(ownerDocument, data){
1137
+ if (!ownerDocument) {
1138
+ ownerDocument = document;
1139
+ }
1140
+ if(supportsUnknownElements){
1141
+ return ownerDocument.createDocumentFragment();
1142
+ }
1143
+ data = data || getExpandoData(ownerDocument);
1144
+ var clone = data.frag.cloneNode(),
1145
+ i = 0,
1146
+ elems = getElements(),
1147
+ l = elems.length;
1148
+ for(;i<l;i++){
1149
+ clone.createElement(elems[i]);
1150
+ }
1151
+ return clone;
1152
+ }
1153
+
1154
+ /**
1155
+ * Shivs the `createElement` and `createDocumentFragment` methods of the document.
1156
+ * @private
1157
+ * @param {Document|DocumentFragment} ownerDocument The document.
1158
+ * @param {Object} data of the document.
1159
+ */
1160
+ function shivMethods(ownerDocument, data) {
1161
+ if (!data.cache) {
1162
+ data.cache = {};
1163
+ data.createElem = ownerDocument.createElement;
1164
+ data.createFrag = ownerDocument.createDocumentFragment;
1165
+ data.frag = data.createFrag();
1166
+ }
1167
+
1168
+
1169
+ ownerDocument.createElement = function(nodeName) {
1170
+ //abort shiv
1171
+ if (!html5.shivMethods) {
1172
+ return data.createElem(nodeName);
1173
+ }
1174
+ return createElement(nodeName, ownerDocument, data);
1175
+ };
1176
+
1177
+ ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
1178
+ 'var n=f.cloneNode(),c=n.createElement;' +
1179
+ 'h.shivMethods&&(' +
1180
+ // unroll the `createElement` calls
1181
+ getElements().join().replace(/\w+/g, function(nodeName) {
1182
+ data.createElem(nodeName);
1183
+ data.frag.createElement(nodeName);
1184
+ return 'c("' + nodeName + '")';
1185
+ }) +
1186
+ ');return n}'
1187
+ )(html5, data.frag);
1188
+ }
1189
+
1190
+ /*--------------------------------------------------------------------------*/
1191
+
1192
+ /**
1193
+ * Shivs the given document.
1194
+ * @memberOf html5
1195
+ * @param {Document} ownerDocument The document to shiv.
1196
+ * @returns {Document} The shived document.
1197
+ */
1198
+ function shivDocument(ownerDocument) {
1199
+ if (!ownerDocument) {
1200
+ ownerDocument = document;
1201
+ }
1202
+ var data = getExpandoData(ownerDocument);
1203
+
1204
+ if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
1205
+ data.hasCSS = !!addStyleSheet(ownerDocument,
1206
+ // corrects block display not defined in IE6/7/8/9
1207
+ 'article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}' +
1208
+ // adds styling not present in IE6/7/8/9
1209
+ 'mark{background:#FF0;color:#000}'
1210
+ );
1211
+ }
1212
+ if (!supportsUnknownElements) {
1213
+ shivMethods(ownerDocument, data);
1214
+ }
1215
+ return ownerDocument;
1216
+ }
1217
+
1218
+ /*--------------------------------------------------------------------------*/
1219
+
1220
+ /**
1221
+ * The `html5` object is exposed so that more elements can be shived and
1222
+ * existing shiving can be detected on iframes.
1223
+ * @type Object
1224
+ * @example
1225
+ *
1226
+ * // options can be changed before the script is included
1227
+ * html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false };
1228
+ */
1229
+ var html5 = {
1230
+
1231
+ /**
1232
+ * An array or space separated string of node names of the elements to shiv.
1233
+ * @memberOf html5
1234
+ * @type Array|String
1235
+ */
1236
+ 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video',
1237
+
1238
+ /**
1239
+ * A flag to indicate that the HTML5 style sheet should be inserted.
1240
+ * @memberOf html5
1241
+ * @type Boolean
1242
+ */
1243
+ 'shivCSS': (options.shivCSS !== false),
1244
+
1245
+ /**
1246
+ * Is equal to true if a browser supports creating unknown/HTML5 elements
1247
+ * @memberOf html5
1248
+ * @type boolean
1249
+ */
1250
+ 'supportsUnknownElements': supportsUnknownElements,
1251
+
1252
+ /**
1253
+ * A flag to indicate that the document's `createElement` and `createDocumentFragment`
1254
+ * methods should be overwritten.
1255
+ * @memberOf html5
1256
+ * @type Boolean
1257
+ */
1258
+ 'shivMethods': (options.shivMethods !== false),
1259
+
1260
+ /**
1261
+ * A string to describe the type of `html5` object ("default" or "default print").
1262
+ * @memberOf html5
1263
+ * @type String
1264
+ */
1265
+ 'type': 'default',
1266
+
1267
+ // shivs the document according to the specified `html5` object options
1268
+ 'shivDocument': shivDocument,
1269
+
1270
+ //creates a shived element
1271
+ createElement: createElement,
1272
+
1273
+ //creates a shived documentFragment
1274
+ createDocumentFragment: createDocumentFragment
1275
+ };
1276
+
1277
+ /*--------------------------------------------------------------------------*/
1278
+
1279
+ // expose html5
1280
+ window.html5 = html5;
1281
+
1282
+ // shiv the document
1283
+ shivDocument(document);
1284
+
1285
+ }(this, document));
1286
+ /*>>shiv*/
1287
+
1288
+ // Assign private properties to the return object with prefix
1289
+ Modernizr._version = version;
1290
+
1291
+ // expose these for the plugin API. Look in the source for how to join() them against your input
1292
+ /*>>prefixes*/
1293
+ Modernizr._prefixes = prefixes;
1294
+ /*>>prefixes*/
1295
+ /*>>domprefixes*/
1296
+ Modernizr._domPrefixes = domPrefixes;
1297
+ Modernizr._cssomPrefixes = cssomPrefixes;
1298
+ /*>>domprefixes*/
1299
+
1300
+ /*>>mq*/
1301
+ // Modernizr.mq tests a given media query, live against the current state of the window
1302
+ // A few important notes:
1303
+ // * If a browser does not support media queries at all (eg. oldIE) the mq() will always return false
1304
+ // * A max-width or orientation query will be evaluated against the current state, which may change later.
1305
+ // * You must specify values. Eg. If you are testing support for the min-width media query use:
1306
+ // Modernizr.mq('(min-width:0)')
1307
+ // usage:
1308
+ // Modernizr.mq('only screen and (max-width:768)')
1309
+ Modernizr.mq = testMediaQuery;
1310
+ /*>>mq*/
1311
+
1312
+ /*>>hasevent*/
1313
+ // Modernizr.hasEvent() detects support for a given event, with an optional element to test on
1314
+ // Modernizr.hasEvent('gesturestart', elem)
1315
+ Modernizr.hasEvent = isEventSupported;
1316
+ /*>>hasevent*/
1317
+
1318
+ /*>>testprop*/
1319
+ // Modernizr.testProp() investigates whether a given style property is recognized
1320
+ // Note that the property names must be provided in the camelCase variant.
1321
+ // Modernizr.testProp('pointerEvents')
1322
+ Modernizr.testProp = function(prop){
1323
+ return testProps([prop]);
1324
+ };
1325
+ /*>>testprop*/
1326
+
1327
+ /*>>testallprops*/
1328
+ // Modernizr.testAllProps() investigates whether a given style property,
1329
+ // or any of its vendor-prefixed variants, is recognized
1330
+ // Note that the property names must be provided in the camelCase variant.
1331
+ // Modernizr.testAllProps('boxSizing')
1332
+ Modernizr.testAllProps = testPropsAll;
1333
+ /*>>testallprops*/
1334
+
1335
+
1336
+ /*>>teststyles*/
1337
+ // Modernizr.testStyles() allows you to add custom styles to the document and test an element afterwards
1338
+ // Modernizr.testStyles('#modernizr { position:absolute }', function(elem, rule){ ... })
1339
+ Modernizr.testStyles = injectElementWithStyles;
1340
+ /*>>teststyles*/
1341
+
1342
+
1343
+ /*>>prefixed*/
1344
+ // Modernizr.prefixed() returns the prefixed or nonprefixed property name variant of your input
1345
+ // Modernizr.prefixed('boxSizing') // 'MozBoxSizing'
1346
+
1347
+ // Properties must be passed as dom-style camelcase, rather than `box-sizing` hypentated style.
1348
+ // Return values will also be the camelCase variant, if you need to translate that to hypenated style use:
1349
+ //
1350
+ // str.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-');
1351
+
1352
+ // If you're trying to ascertain which transition end event to bind to, you might do something like...
1353
+ //
1354
+ // var transEndEventNames = {
1355
+ // 'WebkitTransition' : 'webkitTransitionEnd',
1356
+ // 'MozTransition' : 'transitionend',
1357
+ // 'OTransition' : 'oTransitionEnd',
1358
+ // 'msTransition' : 'MSTransitionEnd',
1359
+ // 'transition' : 'transitionend'
1360
+ // },
1361
+ // transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ];
1362
+
1363
+ Modernizr.prefixed = function(prop, obj, elem){
1364
+ if(!obj) {
1365
+ return testPropsAll(prop, 'pfx');
1366
+ } else {
1367
+ // Testing DOM property e.g. Modernizr.prefixed('requestAnimationFrame', window) // 'mozRequestAnimationFrame'
1368
+ return testPropsAll(prop, obj, elem);
1369
+ }
1370
+ };
1371
+ /*>>prefixed*/
1372
+
1373
+
1374
+ /*>>cssclasses*/
1375
+ // Remove "no-js" class from <html> element, if it exists:
1376
+ docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') +
1377
+
1378
+ // Add the new classes to the <html> element.
1379
+ (enableClasses ? ' js ' + classes.join(' ') : '');
1380
+ /*>>cssclasses*/
1381
+
1382
+ return Modernizr;
1383
+
1384
+ })(this, this.document);