diff --git a/dist/details-element-polyfill.js b/dist/details-element-polyfill.js index ee20b5a..473ad23 100644 --- a/dist/details-element-polyfill.js +++ b/dist/details-element-polyfill.js @@ -1,24 +1,15 @@ /* -Details Element Polyfill 2.3.1 +Details Element Polyfill 2.4.0 Copyright © 2019 Javan Makhmali */ (function() { "use strict"; var element = document.createElement("details"); - element.innerHTML = "ab"; - element.setAttribute("style", "position: absolute; left: -9999px"); + var elementIsNative = typeof HTMLDetailsElement != "undefined" && element instanceof HTMLDetailsElement; var support = { - open: "open" in element && elementExpands(), + open: "open" in element || elementIsNative, toggle: "ontoggle" in element }; - function elementExpands() { - (document.body || document.documentElement).appendChild(element); - var closedHeight = element.offsetHeight; - element.open = true; - var openedHeight = element.offsetHeight; - element.parentNode.removeChild(element); - return closedHeight != openedHeight; - } var styles = '\ndetails, summary {\n display: block;\n}\ndetails:not([open]) > *:not(summary) {\n display: none;\n}\nsummary::before {\n content: "►";\n padding-right: 0.3rem;\n font-size: 0.6rem;\n cursor: default;\n}\n[open] > summary::before {\n content: "▼";\n}\n'; var _ref = [], forEach = _ref.forEach, slice = _ref.slice; if (!support.open) { diff --git a/package.json b/package.json index bc9dafd..dd42a03 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "details-element-polyfill", - "version": "2.3.1", + "version": "2.4.0", "description": "HTML
element polyfill", "main": "dist/details-element-polyfill.js", "files": [