4 ms·
It's even more verbose in a lot of common cases, actually. (Although the ? operator has made things better). --- 1. document.querySelectorAll(".sel").forEach(
by strokirk 4y ago
It's even more verbose in a lot of common cases, actually. (Although the ? operator has made things better).
---
1. document.querySelectorAll(".sel").forEach((e) => e.addEventListener("click", (e) => {}))
$('.sel').on('click', (e) => {})
2. document.querySelector(".sel")?.addEventListener("click", (e) => {})
$('.sel').on('click', (e) => {})
3. const e = document.createElement("div")
e.className = "cls"
e.setAttribute("title", "Title")
e.textContent = "<Content>"
const e = $('<div>').addClass("cls").attr("title", "Title").text("<Content>")