Browse Source

src : miniModernizr : change tests to an object; add JSHint options

pull/96/head
David DeSandro 14 years ago
parent
commit
37fce6dd6f
  1. 47
      jquery.isotope.js
  2. 5
      jquery.isotope.min.js

47
jquery.isotope.js

@ -1,5 +1,5 @@
/** /**
* Isotope v1.4.110629 * Isotope v1.4.110630
* An exquisite jQuery plugin for magical layouts * An exquisite jQuery plugin for magical layouts
* http://isotope.metafizzy.co * http://isotope.metafizzy.co
* *
@ -9,6 +9,7 @@
* Copyright 2011 David DeSandro / Metafizzy * Copyright 2011 David DeSandro / Metafizzy
*/ */
/*jshint curly: true, eqeqeq: true, forin: false, immed: false, newcap: true, noempty: true, undef: true */
/*global Modernizr: true */ /*global Modernizr: true */
(function( window, $, undefined ){ (function( window, $, undefined ){
@ -62,22 +63,17 @@
* http://www.modernizr.com/license/ * http://www.modernizr.com/license/
*/ */
/* /*
* This version whittles down the script just to check support for * This version whittles down the script just to check support for
* CSS transitions, transforms, and 3D transforms. * CSS transitions, transforms, and 3D transforms.
*/ */
var tests = [ var tests = {
{ csstransforms: function() {
name : 'csstransforms',
getResult : function() {
return !!transformProp; return !!transformProp;
}
}, },
{
name : 'csstransforms3d', csstransforms3d: function() {
getResult : function() {
var test = !!getStyleProperty('perspective'); var test = !!getStyleProperty('perspective');
// double check for Chrome's false positive // double check for Chrome's false positive
if ( test ) { if ( test ) {
@ -93,26 +89,19 @@
$style.remove(); $style.remove();
} }
return test; return test;
}
}, },
{
name : 'csstransitions', csstransitions: function() {
getResult : function() {
return !!getStyleProperty('transitionProperty'); return !!getStyleProperty('transitionProperty');
} }
} };
],
i, len = tests.length
;
if ( window.Modernizr ) { if ( window.Modernizr ) {
// if there's a previous Modernzir, check if there are necessary tests // if there's a previous Modernzir, check if there are necessary tests
for ( i=0; i < len; i++ ) { for ( var testName in tests) {
var test = tests[i]; if ( !Modernizr.hasOwnProperty( testName ) ) {
if ( !Modernizr.hasOwnProperty( test.name ) ) {
// if test hasn't been run, use addTest to run it // if test hasn't been run, use addTest to run it
Modernizr.addTest( test.name, test.getResult ); Modernizr.addTest( testName, tests[ testName ] );
} }
} }
} else { } else {
@ -123,15 +112,13 @@
_version : '1.6ish: miniModernizr for Isotope' _version : '1.6ish: miniModernizr for Isotope'
}, },
classes = ' ', classes = ' ',
test, result, result, testName;
className;
// Run through tests // Run through tests
for ( i=0; i < len; i++ ) { for ( testName in tests) {
test = tests[i]; result = tests[ testName ]();
result = test.getResult(); miniModernizr[ testName ] = result;
miniModernizr[ test.name ] = result; classes += ' ' + ( result ? '' : 'no-' ) + testName;
classes += ' ' + ( result ? '' : 'no-' ) + test.name;
} }
// Add the new classes to the <html> element. // Add the new classes to the <html> element.

5
jquery.isotope.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save