css-displaytable.js 924 B

123456789101112131415161718192021222324252627
  1. // display: table and table-cell test. (both are tested under one name "table-cell" )
  2. // By @scottjehl
  3. // all additional table display values are here: http://pastebin.com/Gk9PeVaQ though Scott has seen some IE false positives with that sort of weak detection.
  4. // more testing neccessary perhaps.
  5. Modernizr.addTest( "display-table",function(){
  6. var doc = window.document,
  7. docElem = doc.documentElement,
  8. parent = doc.createElement( "div" ),
  9. child = doc.createElement( "div" ),
  10. childb = doc.createElement( "div" ),
  11. ret;
  12. parent.style.cssText = "display: table";
  13. child.style.cssText = childb.style.cssText = "display: table-cell; padding: 10px";
  14. parent.appendChild( child );
  15. parent.appendChild( childb );
  16. docElem.insertBefore( parent, docElem.firstChild );
  17. ret = child.offsetLeft < childb.offsetLeft;
  18. docElem.removeChild(parent);
  19. return ret;
  20. });