1
0
mirror of https://github.com/chylex/Lightning-Tracker.git synced 2024-11-24 22:42:50 +01:00
Lightning-Tracker/res/~resources/js/polyfill/details.js

27 lines
621 B
JavaScript

"use strict";
if (!("open" in document.createElement("details"))){
window.addEventListener("click", function(e){
var target = e.target;
if (target.tagName !== "SUMMARY"){
return;
}
var details = target.parentElement;
if (details.tagName !== "DETAILS"){
return;
}
if (details.hasAttribute("open")){
details.removeAttribute("open");
details.open = false;
}
else{
details.setAttribute("open", "");
details.open = true;
}
});
}