Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

elem-details.js 779B

12345678910111213141516171819202122232425
  1. // By @mathias, based on http://mths.be/axh
  2. Modernizr.addTest('details', function() {
  3. var doc = document,
  4. el = doc.createElement('details'),
  5. fake,
  6. root,
  7. diff;
  8. if (!('open' in el)) { // return early if possible; thanks @aFarkas!
  9. return false;
  10. }
  11. root = doc.body || (function() {
  12. var de = doc.documentElement;
  13. fake = true;
  14. return de.insertBefore(doc.createElement('body'), de.firstElementChild || de.firstChild);
  15. }());
  16. el.innerHTML = '<summary>a</summary>b';
  17. el.style.display = 'block';
  18. root.appendChild(el);
  19. diff = el.offsetHeight;
  20. el.open = true;
  21. diff = diff != el.offsetHeight;
  22. root.removeChild(el);
  23. fake && root.parentNode.removeChild(root);
  24. return diff;
  25. });