Browse Source

src : Modernizr - missing vars and white space fixes

pull/14/head
David DeSandro 14 years ago
parent
commit
d14a881402
  1. 38
      jquery.isotope.js

38
jquery.isotope.js

@ -72,7 +72,9 @@
* CSS transitions, transforms, and 3D transforms. * CSS transitions, transforms, and 3D transforms.
*/ */
var tests = [ var docElement = document.documentElement,
vendorCSSPrefixes = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '),
tests = [
{ {
name : 'csstransforms', name : 'csstransforms',
getResult : function() { getResult : function() {
@ -90,7 +92,7 @@
mq = '@media (' + vendorCSSPrefixes.join('transform-3d),(') + 'modernizr)'; mq = '@media (' + vendorCSSPrefixes.join('transform-3d),(') + 'modernizr)';
st.textContent = mq + '{#modernizr{height:3px}}'; st.textContent = mq + '{#modernizr{height:3px}}';
(doc.head || doc.getElementsByTagName('head')[0]).appendChild(st); (document.head || document.getElementsByTagName('head')[0]).appendChild(st);
div.id = 'modernizr'; div.id = 'modernizr';
docElement.appendChild(div); docElement.appendChild(div);
@ -111,41 +113,28 @@
], ],
i, len = tests.length i, len = tests.length
; ;
if ( window.Modernizr ) { if ( window.Modernizr ) {
// hasOwnProperty shim by kangax needed for Safari 2.0 support // if there's a previous Modernzir, check if there are necessary tests
// var _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));
// };
// }
for ( i=0; i < len; i++ ) { for ( i=0; i < len; i++ ) {
var test = test[i]; var test = tests[i];
if ( !Modernizr.hasOwnProperty( test.name ) ) { if ( !Modernizr.hasOwnProperty( test.name ) ) {
// if test hasn't been run, use addTest to run it
Modernizr.addTest( test.name, test.getResult ); Modernizr.addTest( test.name, test.getResult );
} }
} }
} else { } else {
// or create new mini Modernizr that just has the 3 tests
window.Modernizr = (function(){ window.Modernizr = (function(){
var version = '1.6ish: miniModernizr for Isotope', var miniModernizr = {
miniModernizr = {}, _version : '1.6ish: miniModernizr for Isotope'
vendorCSSPrefixes = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '), },
classes = [], classes = [],
test, result, className; test, result, className;
// Run through all tests and detect their support in the current UA. // Run through tests
for ( i=0; i < len; i++ ) { for ( i=0; i < len; i++ ) {
test = tests[i]; test = tests[i];
result = test.getResult(); result = test.getResult();
@ -155,10 +144,9 @@
} }
// Add the new classes to the <html> element. // Add the new classes to the <html> element.
document.documentElement.className += ' ' + classes.join( ' ' ); docElement.className += ' ' + classes.join( ' ' );
return miniModernizr; return miniModernizr;
})(); })();
} }

Loading…
Cancel
Save