Browse Source

src : miniModernizr : refactor for jQuery

pull/96/head
David DeSandro 14 years ago
parent
commit
2bea6b58f4
  1. 34
      jquery.isotope.js
  2. 2
      jquery.isotope.min.js

34
jquery.isotope.js

@ -82,23 +82,19 @@
getResult : 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 ) {
var st = document.createElement('style'), var vendorCSSPrefixes = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '),
div = document.createElement('div'), mediaQuery = '@media (' + vendorCSSPrefixes.join('transform-3d),(') + 'modernizr)',
vendorCSSPrefixes = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '), $style = $('<style>' + mediaQuery + '{#modernizr{height:3px}}' + '</style>')
mq = '@media (' + vendorCSSPrefixes.join('transform-3d),(') + 'modernizr)'; .appendTo('head'),
$div = $('<div id="modernizr" />').appendTo('html');
st.textContent = mq + '{#modernizr{height:3px}}'; test = $div.height() === 3;
(document.head || document.getElementsByTagName('head')[0]).appendChild(st);
div.id = 'modernizr';
docElement.appendChild(div);
test = div.offsetHeight === 3; $div.remove();
$style.remove();
st.parentNode.removeChild(st);
div.parentNode.removeChild(div);
} }
return !!test; return test;
} }
}, },
{ {
@ -128,20 +124,20 @@
var miniModernizr = { var miniModernizr = {
_version : '1.6ish: miniModernizr for Isotope' _version : '1.6ish: miniModernizr for Isotope'
}, },
classes = [], classes = ' ',
test, result, className; test, result,
className;
// Run through tests // 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();
miniModernizr[ test.name ] = result; miniModernizr[ test.name ] = result;
className = ( result ? '' : 'no-' ) + test.name; classes += ' ' + ( result ? '' : 'no-' ) + test.name;
classes.push( className );
} }
// Add the new classes to the <html> element. // Add the new classes to the <html> element.
docElement.className += ' ' + classes.join( ' ' ); $('html').addClass( classes );
return miniModernizr; return miniModernizr;
})(); })();

2
jquery.isotope.min.js vendored

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