/* Modernizr 2.5.3 (Custom Build) | MIT & BSD * Build: http://www.modernizr.com/download/#-cssclasses-addtest-prefixed-testprop-testallprops-domprefixes-cssclassprefix:feature! */ ; window.Modernizr = (function( window, document, undefined ) { var version = '2.5.3', Modernizr = {}, enableClasses = true, docElement = document.documentElement, mod = 'modernizr', modElem = document.createElement(mod), mStyle = modElem.style, inputElem , toString = {}.toString, omPrefixes = 'Webkit Moz O ms', cssomPrefixes = omPrefixes.split(' '), domPrefixes = omPrefixes.toLowerCase().split(' '), tests = {}, inputs = {}, attrs = {}, classes = [], slice = classes.slice, featureName, _hasOwnProperty = ({}).hasOwnProperty, hasOwnProperty; if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) { hasOwnProperty = function (object, property) { return _hasOwnProperty.call(object, property); }; } else { hasOwnProperty = 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 testProps( props, prefixed ) { for ( var i in props ) { if ( mStyle[ props[i] ] !== undefined ) { return prefixed == 'pfx' ? props[i] : true; } } return false; } 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; } function testPropsAll( prop, prefixed, elem ) { var ucProp = prop.charAt(0).toUpperCase() + prop.substr(1), props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' '); if(is(prefixed, "string") || is(prefixed, "undefined")) { return testProps(props, prefixed); } else { props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' '); return testDOMProps(props, prefixed, elem); } } for ( var feature in tests ) { if ( hasOwnProperty(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 ( hasOwnProperty( feature, key ) ) { Modernizr.addTest( key, feature[ key ] ); } } } else { feature = feature.toLowerCase(); if ( Modernizr[feature] !== undefined ) { return Modernizr; } test = typeof test == 'function' ? test() : test; docElement.className+=" feature-" + (test ? '' : 'no-') + feature; Modernizr[feature] = test; } return Modernizr; }; setCss(''); modElem = inputElem = null; Modernizr._version = version; Modernizr._domPrefixes = domPrefixes; Modernizr._cssomPrefixes = cssomPrefixes; Modernizr.testProp = function(prop){ return testProps([prop]); }; Modernizr.testAllProps = testPropsAll; Modernizr.prefixed = function(prop, obj, elem){ if(!obj) { return testPropsAll(prop, 'pfx'); } else { return testPropsAll(prop, obj, elem); } }; docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') + (enableClasses ? " feature-js feature-"+classes.join(" feature-") : ''); return Modernizr; })(this, this.document); ; // CSS Regions // http://www.w3.org/TR/css3-regions/ // By: Mihai Balan // We start with a CSS parser test then we check page geometry to see if it's affected by regions // Later we might be able to retire the second part, as WebKit builds with the false positives die out Modernizr.addTest('regions', function() { /* Get the 'flowFrom' property name available in the browser. Either default or vendor prefixed. If the property name can't be found we'll get Boolean 'false' and fail quickly */ var flowFromProperty = Modernizr.prefixed("flowFrom"), flowIntoProperty = Modernizr.prefixed("flowInto"); if (!flowFromProperty || !flowIntoProperty){ return false; } /* If CSS parsing is there, try to determine if regions actually work. */ var container = document.createElement('div'), content = document.createElement('div'), region = document.createElement('div'), /* we create a random, unlikely to be generated flow number to make sure we don't clash with anything more vanilla, like 'flow', or 'article', or 'f1' */ flowName = 'modernizr_flow_for_regions_check'; /* First create a div with two adjacent divs inside it. The first will be the content, the second will be the region. To be able to distinguish between the two, we'll give the region a particular padding */ content.innerText = 'M'; container.style.cssText = 'top: 150px; left: 150px; padding: 0px;'; region.style.cssText = 'width: 50px; height: 50px; padding: 42px;'; region.style[flowFromProperty] = flowName; container.appendChild(content); container.appendChild(region); document.documentElement.appendChild(container); /* Now compute the bounding client rect, before and after attempting to flow the content div in the region div. If regions are enabled, the after bounding rect should reflect the padding of the region div.*/ var flowedRect, delta, plainRect = content.getBoundingClientRect(); content.style[flowIntoProperty] = flowName; flowedRect = content.getBoundingClientRect(); delta = flowedRect.left - plainRect.left; document.documentElement.removeChild(container); content = region = container = undefined; return (delta == 42); });