Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jordan Humphreys
committed
Aug 21, 2012
1 parent
e497120
commit d210e66
Showing
3 changed files
with
273 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,224 @@ | ||
/* Modernizr 2.5.3 (Custom Build) | MIT & BSD | ||
/* Modernizr 2.6.1 (Custom Build) | MIT & BSD | ||
* Build: http://modernizr.com/download/#-mq-teststyles | ||
*/ | ||
;window.Modernizr=function(a,b,c){function v(a){i.cssText=a}function w(a,b){return v(prefixes.join(a+";")+(b||""))}function x(a,b){return typeof a===b}function y(a,b){return!!~(""+a).indexOf(b)}function z(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:x(f,"function")?f.bind(d||b):f}return!1}var d="2.5.3",e={},f=b.documentElement,g="modernizr",h=b.createElement(g),i=h.style,j,k={}.toString,l={},m={},n={},o=[],p=o.slice,q,r=function(a,c,d,e){var h,i,j,k=b.createElement("div"),l=b.body,m=l?l:b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:g+(d+1),k.appendChild(j);return h=["­","<style>",a,"</style>"].join(""),k.id=g,(l?k:m).innerHTML+=h,m.appendChild(k),l||(m.style.background="",f.appendChild(m)),i=c(k,a),l?k.parentNode.removeChild(k):m.parentNode.removeChild(m),!!i},s=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return r("@media "+b+" { #"+g+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},t={}.hasOwnProperty,u;!x(t,"undefined")&&!x(t.call,"undefined")?u=function(a,b){return t.call(a,b)}:u=function(a,b){return b in a&&x(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=p.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(p.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(p.call(arguments)))};return e});for(var A in l)u(l,A)&&(q=A.toLowerCase(),e[q]=l[A](),o.push((e[q]?"":"no-")+q));return v(""),h=j=null,e._version=d,e.mq=s,e.testStyles=r,e}(this,this.document); | ||
; | ||
|
||
|
||
|
||
window.Modernizr = (function( window, document, undefined ) { | ||
|
||
var version = '2.6.1', | ||
|
||
Modernizr = {}, | ||
|
||
|
||
docElement = document.documentElement, | ||
|
||
mod = 'modernizr', | ||
modElem = document.createElement(mod), | ||
mStyle = modElem.style, | ||
|
||
inputElem , | ||
|
||
|
||
toString = {}.toString, tests = {}, | ||
inputs = {}, | ||
attrs = {}, | ||
|
||
classes = [], | ||
|
||
slice = classes.slice, | ||
|
||
featureName, | ||
|
||
|
||
injectElementWithStyles = function( rule, callback, nodes, testnames ) { | ||
|
||
var style, ret, node, | ||
div = document.createElement('div'), | ||
body = document.body, | ||
fakeBody = body ? body : document.createElement('body'); | ||
|
||
if ( parseInt(nodes, 10) ) { | ||
while ( nodes-- ) { | ||
node = document.createElement('div'); | ||
node.id = testnames ? testnames[nodes] : mod + (nodes + 1); | ||
div.appendChild(node); | ||
} | ||
} | ||
|
||
style = ['­','<style id="s', mod, '">', rule, '</style>'].join(''); | ||
div.id = mod; | ||
(body ? div : fakeBody).innerHTML += style; | ||
fakeBody.appendChild(div); | ||
if ( !body ) { | ||
fakeBody.style.background = ""; | ||
docElement.appendChild(fakeBody); | ||
} | ||
|
||
ret = callback(div, rule); | ||
!body ? fakeBody.parentNode.removeChild(fakeBody) : div.parentNode.removeChild(div); | ||
|
||
return !!ret; | ||
|
||
}, | ||
|
||
testMediaQuery = function( mq ) { | ||
|
||
var matchMedia = window.matchMedia || window.msMatchMedia; | ||
if ( matchMedia ) { | ||
return matchMedia(mq).matches; | ||
} | ||
|
||
var bool; | ||
|
||
injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) { | ||
bool = (window.getComputedStyle ? | ||
getComputedStyle(node, null) : | ||
node.currentStyle)['position'] == 'absolute'; | ||
}); | ||
|
||
return bool; | ||
|
||
}, | ||
_hasOwnProperty = ({}).hasOwnProperty, hasOwnProp; | ||
|
||
if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) { | ||
hasOwnProp = function (object, property) { | ||
return _hasOwnProperty.call(object, property); | ||
}; | ||
} | ||
else { | ||
hasOwnProp = function (object, property) { | ||
return ((property in object) && is(object.constructor.prototype[property], 'undefined')); | ||
}; | ||
} | ||
|
||
|
||
if (!Function.prototype.bind) { | ||
Function.prototype.bind = function bind(that) { | ||
|
||
var target = this; | ||
|
||
if (typeof target != "function") { | ||
throw new TypeError(); | ||
} | ||
|
||
var args = slice.call(arguments, 1), | ||
bound = function () { | ||
|
||
if (this instanceof bound) { | ||
|
||
var F = function(){}; | ||
F.prototype = target.prototype; | ||
var self = new F(); | ||
|
||
var result = target.apply( | ||
self, | ||
args.concat(slice.call(arguments)) | ||
); | ||
if (Object(result) === result) { | ||
return result; | ||
} | ||
return self; | ||
|
||
} else { | ||
|
||
return target.apply( | ||
that, | ||
args.concat(slice.call(arguments)) | ||
); | ||
|
||
} | ||
|
||
}; | ||
|
||
return bound; | ||
}; | ||
} | ||
|
||
function setCss( str ) { | ||
mStyle.cssText = str; | ||
} | ||
|
||
function setCssAll( str1, str2 ) { | ||
return setCss(prefixes.join(str1 + ';') + ( str2 || '' )); | ||
} | ||
|
||
function is( obj, type ) { | ||
return typeof obj === type; | ||
} | ||
|
||
function contains( str, substr ) { | ||
return !!~('' + str).indexOf(substr); | ||
} | ||
|
||
|
||
function testDOMProps( props, obj, elem ) { | ||
for ( var i in props ) { | ||
var item = obj[props[i]]; | ||
if ( item !== undefined) { | ||
|
||
if (elem === false) return props[i]; | ||
|
||
if (is(item, 'function')){ | ||
return item.bind(elem || obj); | ||
} | ||
|
||
return item; | ||
} | ||
} | ||
return false; | ||
} | ||
for ( var feature in tests ) { | ||
if ( hasOwnProp(tests, feature) ) { | ||
featureName = feature.toLowerCase(); | ||
Modernizr[featureName] = tests[feature](); | ||
|
||
classes.push((Modernizr[featureName] ? '' : 'no-') + featureName); | ||
} | ||
} | ||
|
||
|
||
|
||
Modernizr.addTest = function ( feature, test ) { | ||
if ( typeof feature == 'object' ) { | ||
for ( var key in feature ) { | ||
if ( hasOwnProp( feature, key ) ) { | ||
Modernizr.addTest( key, feature[ key ] ); | ||
} | ||
} | ||
} else { | ||
|
||
feature = feature.toLowerCase(); | ||
|
||
if ( Modernizr[feature] !== undefined ) { | ||
return Modernizr; | ||
} | ||
|
||
test = typeof test == 'function' ? test() : test; | ||
|
||
if (enableClasses) { | ||
docElement.className += ' ' + (test ? '' : 'no-') + feature; | ||
} | ||
Modernizr[feature] = test; | ||
|
||
} | ||
|
||
return Modernizr; | ||
}; | ||
|
||
|
||
setCss(''); | ||
modElem = inputElem = null; | ||
|
||
|
||
Modernizr._version = version; | ||
|
||
|
||
Modernizr.mq = testMediaQuery; | ||
Modernizr.testStyles = injectElementWithStyles; | ||
return Modernizr; | ||
|
||
})(this, this.document); | ||
; |