"The other difference is that there is ",el("strong","no")," ",el("code","off")," function.",
" ",
"You can remove listener declaratively using ",el("a",{textContent:"AbortSignal",href:"https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#signal",title:"part of addEventListener on MDN"}),
el("li").append(el("code",`el("button", { textContent: "click me" }, on("click", console.log))`))
),
el("p").append(
"In the first example we force to use HTML attribute (it corresponds to ",el("code",`<button onclick="console.log(event)">click me</button>`),").",
" ",
el("em","Side note: this can be useful in case of SSR."),
" ",
"To study difference, you can read a nice summary here: ",el("a",{href:"https://gist.github.com/WebReflection/b404c36f46371e3b1173bf5492acc944",textContent:"GIST @WebReflection/web_events.md"}),"."
"For Custom elements, we will later introduce a way to replace ",el("code","*Callback"),
" syntax with ",el("code","dde:*")," events. The ",el("code","on.*")," functions then",
" listen to the appropriate Custom Elements events (see ",el("a",{textContent:"Custom element lifecycle callbacks | MDN",href:"https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks"}),")."
),
el("p").append(
"But, in case of regular elemnets the ",el("a",{href:"https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver"}).append(el("code","MutationObserver")," | MDN"),
" is internaly used to track these events. Therefore, there are some drawbacks:",
),
el("ul").append(
el("li").append(
"To proper listener registration, you need to use ",el("code","on.*")," not `on(\"dde:*\", …)`!"
),
el("li").append(
"Use sparingly! Internally, library must loop of all registered events and fires event properly.",
" ",
el("strong","It is good practice to use the fact that if an element is removed, its children are also removed!"),
" ",
"In this spirit, we will introduce later the ",el("strong","host")," syntax to register",
" clean up procedures when the component is removed from the app."