Guest User

Modernizr display tests for table layout

a guest
Nov 2nd, 2010
16,381
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function() {
  2.     var displayTests = ["table", "table-caption", "table-cell",
  3.     "table-column", "table-column-group", "table-footer-group",
  4.     "table-header-group", "table-row", "table-row-group"];
  5.    
  6.     var rules = document.createElement("div").style;
  7.  
  8.     for (var c=0; c<displayTests.length; c++) {
  9.         var testValue = displayTests[c];
  10.         Modernizr.addTest("display" + testValue, function() {
  11.             try {
  12.                 rules.display = testValue;
  13.                 return rules.display == testValue;
  14.             } catch (e) {
  15.                 return false;
  16.             }
  17.         })
  18.     }
  19. }());
RAW Paste Data