forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodernizr.details.js
31 lines (29 loc) · 931 Bytes
/
modernizr.details.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// By @mathias, based on http://mths.be/axh
define([
'modernizr/modernizr'
], function(){
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;
});
});