Skip to content

Instantly share code, notes, and snippets.

@tylercunnion
Created March 26, 2012 06:53
Show Gist options
  • Save tylercunnion/2203540 to your computer and use it in GitHub Desktop.
Save tylercunnion/2203540 to your computer and use it in GitHub Desktop.
Modernizr test for table cell box model
/*
* Firefox does not use the correct box model when setting the height of table
* cells. See http://oldtinroof.com/2010/03/table-cell-min-height-in-firefox/.
* This Modernizr test returns true if the correct box model is adhered to.
*/
Modernizr.addTest('table-content-box', function() {
var generatedHeight, td;
td = document.createElement('td');
td.style['border'] = '1px solid black';
td.style['height'] = '1px';
document.body.appendChild(td);
generatedHeight = td.offsetHeight;
document.body.removeChild(td);
return generatedHeight === 3;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment