displaytable.js 947 B

123456789101112131415161718192021222324252627
  1. /*!
  2. {
  3. "name": "CSS Display table",
  4. "property": "displaytable",
  5. "caniuse": "css-table",
  6. "authors": ["scottjehl"],
  7. "tags": ["css"],
  8. "builderAliases": ["css_displaytable"],
  9. "notes": [{
  10. "name": "Detects for all additional table display values",
  11. "href": "https://pastebin.com/Gk9PeVaQ"
  12. }]
  13. }
  14. !*/
  15. /* DOC
  16. `display: table` and `table-cell` test. (both are tested under one name `table-cell` )
  17. */
  18. define(['Modernizr', 'testStyles'], function(Modernizr, testStyles) {
  19. // If a document is in rtl mode this test will fail so we force ltr mode on the injected
  20. // element https://github.com/Modernizr/Modernizr/issues/716
  21. testStyles('#modernizr{display: table; direction: ltr}#modernizr div{display: table-cell; padding: 10px}', function(elem) {
  22. var ret;
  23. var child = elem.childNodes;
  24. ret = child[0].offsetLeft < child[1].offsetLeft;
  25. Modernizr.addTest('displaytable', ret, {aliases: ['display-table']});
  26. }, 2);
  27. });