The website of Ura Design
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
779 B

// By @mathias, based on http://mths.be/axh
Modernizr.addTest('details', function() {
var doc = document,
el = doc.createElement('details'),
fake,
root,
diff;
if (!('open' in el)) { // return early if possible; thanks @aFarkas!
return false;
}
root = doc.body || (function() {
var de = doc.documentElement;
fake = true;
return de.insertBefore(doc.createElement('body'), de.firstElementChild || de.firstChild);
}());
el.innerHTML = '<summary>a</summary>b';
el.style.display = 'block';
root.appendChild(el);
diff = el.offsetHeight;
el.open = true;
diff = diff != el.offsetHeight;
root.removeChild(el);
fake && root.parentNode.removeChild(root);
return diff;
});