// Obliczanie class Obliczanie extends HTMLElement { elementy = {}; dzialanie = ""; constructor() { super(); this.shadow = this.attachShadow({ mode: "open" }); } wylicz() { let operacja = this.dzialanie; let pelne = true; for (const znak in this.elementy) { const element = this.shadow.getElementById(znak); if (element == null || element.value == "") { pelne = false; continue; } operacja = operacja.replaceAll(znak, element == null ? "" : element.value); } if (!pelne) { this.wynik.innerText = operacja; return; } try { this.wynik.innerText = eval(operacja); } catch { this.wynik.innerText = "Nieprawidłowa operacja"; } } connectedCallback() { const styl = document.createElement("style"); styl.textContent = ` @import url('/assets/css/baza.css'); `; this.dzialanie = this.getAttribute("dzialanie") ?? ""; if (this.dzialanie == "") { this.shadow.innerHTML = "