import from la bonne adresse and first refactoring for ouidade.com
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
// 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;
|
||||
});
|
||||
Reference in New Issue
Block a user