🐛Prevent potential null elements

because {% component_js_dependencies %} loads all the components regardless
This commit is contained in:
KimSia, Sim 2022-07-23 14:42:48 +08:00
parent f5c3f64c86
commit bb256f2ec8
No known key found for this signature in database
GPG key ID: 5C51FB99C703F242
2 changed files with 9 additions and 5 deletions

View file

@ -1,3 +1,5 @@
(function(){
document.querySelector(".calendar-component").onclick = function(){alert("Clicked calendar!")}
if (document.querySelector(".calendar-component")) {
document.querySelector(".calendar-component").onclick = function(){ alert("Clicked calendar!"); };
}
})()