treehouse/static/js/thanks-webkit.js

22 lines
671 B
JavaScript
Raw Normal View History

2023-08-27 19:40:47 +02:00
// Detect if we can have crucial functionality (ie. custom elements call constructors).
2024-02-21 23:17:19 +01:00
// This doesn't seem to happen in Epiphany, and also other Webkit-based browsers.
2023-08-27 19:40:47 +02:00
let works = false;
class WebkitMoment extends HTMLLIElement {
constructor() {
super();
works = true;
}
}
customElements.define("th-webkit-moment", WebkitMoment, { extends: "li" });
let willItWorkOrWillItNot = document.createElement("div");
willItWorkOrWillItNot.innerHTML = `<li is="th-webkit-moment"></li>`;
// If my takeoff fails
// tell my mother I'm sorry
let box = document.getElementById("webkit-makes-me-go-insane");
if (!works) {
box.style = "display: block";
}