mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-19 08:01:04 +00:00
36 lines
904 B
JavaScript
36 lines
904 B
JavaScript
/*!
|
|
{
|
|
"name": "details Element",
|
|
"caniuse": "details",
|
|
"property": "details",
|
|
"tags": ["elem"],
|
|
"builderAliases": ["elem_details"],
|
|
"authors": ["@mathias"],
|
|
"notes": [{
|
|
"name": "Mathias' Original",
|
|
"href": "https://mathiasbynens.be/notes/html5-details-jquery#comment-35"
|
|
}]
|
|
}
|
|
!*/
|
|
define(['Modernizr', 'createElement', 'docElement', 'testStyles'], function(Modernizr, createElement, docElement, testStyles) {
|
|
Modernizr.addTest('details', function() {
|
|
var el = createElement('details');
|
|
var diff;
|
|
|
|
// return early if possible; thanks @aFarkas!
|
|
if (!('open' in el)) {
|
|
return false;
|
|
}
|
|
|
|
testStyles('#modernizr details{display:block}', function(node) {
|
|
node.appendChild(el);
|
|
el.innerHTML = '<summary>a</summary>b';
|
|
diff = el.offsetHeight;
|
|
el.open = true;
|
|
diff = diff !== el.offsetHeight;
|
|
});
|
|
|
|
return diff;
|
|
});
|
|
});
|