Profile

Work

I am a Full-Stack Web & Software Developer with over fifteen years of experience. Over countless hours I have discovered that I have a passion and talent for creating works that are both highly functional and technically sound.

I have also discovered that I have a knack for understanding new theories & concepts – I am an adamant perfectionist when it comes to just about anything I do.

Current Skill set

Web
  • Responsive Mobile first HTML & CSS3 – Bootstrap, SASS
  • JavaScript (Vanilla JS, JQuery, Angular)
  • PHP (Web Server & CRON)
  • CRM / CMS packages – WordPress, OsCommerce, Marketo
  • MySQL
  • Git
  • SEO & PPC
Applications
  • Java
  • Python
Legacy Technology
  • ASP (classic)
  • Visual Basic
  • Adobe Flash
Software Packages
  • Adobe Photoshop
  • MySQL
  • Jet Brains Web Suite
  • Microsoft Word
  • Microsoft Excel
  • Microsoft Access
  • Maya 3d
  • and more…

Study

At the start of 2019, I am entering my 4th year of a 6 year course Studying a Bachelor of
Computer Science with gaming specialisation at Charles Sturt University

Hobbies

Pyrotechnic

A license Pyrotechnician in the state of N.S.W. Australia for over twenty years, performing
professional grade pyrotechnic shows ranging from from Chinese String Crackers, Indoor Close
Proximity Fireworks, Aerial Shells up to 125mm and Aerial Salutes up to 75mm.

A founding member of the Pyrotechnics Industry Association of Australia (PIAA), Based in Sydney
but have performing shows all over NSW for all types of events.

Car Enthusiast

An active member in the Skylines Australia NSW car club I regularly volunteer to help run events.

Social Media

You can connect with me professionally on LinkedIn,
or stalk me through Twitter

Portfolio

Employment

Wizardry Fireworks

PRODOCOM Australia

Hannover Fairs Australia

E-Web Marketing

Freelance Websites

Personal Projects

Tipping Comp

cruizen’

National Pyrotechnics

iblott accessories

Blog

What is event delegation? A Comprehensive Guide

In the realm of JavaScript and web development, event delegation is a powerful and efficient technique that enables developers to manage events dynamically. Understanding and implementing event delegation can significantly enhance the performance and maintainability of your applications. In this article, we’ll dive deep into what event delegation is, how it works, and why it’s an essential tool for modern web development.

What is Event Delegation?

Event delegation is a design pattern in JavaScript where a single event listener is attached to a parent element to manage events for its child elements. Instead of attaching individual listeners to each child element, the parent element’s listener “delegates” the handling of events that occur on its children.

This approach leverages the concept of event bubbling, where events triggered on a child element propagate up to its parent elements. By capturing these events at a higher level in the DOM tree, developers can efficiently handle interactions for multiple elements without the overhead of multiple listeners.

How Does Event Delegation Work?

Event delegation relies on two core JavaScript concepts:

  1. Event Bubbling: When an event occurs on an element, it first runs the handlers on that element, then propagates up to its parent, grandparent, and so on, until it reaches the root of the DOM tree.
  2. Event Targeting: The event.target property specifies the exact element that triggered the event, even if the listener is attached to a parent element.

Here’s an example to illustrate:

// HTML structure
<ul id="menu">
  <li>Home</li>
  <li>About</li>
  <li>Contact</li>
</ul>

// JavaScript implementation
const menu = document.getElementById('menu');

menu.addEventListener('click', function(event) {
  if (event.target.tagName === 'LI') {
    console.log(`You clicked on: ${event.target.textContent}`);
  }
});

In this example, a single click event listener is attached to the ul element. When a li item is clicked, the event bubbles up to the ul, and the listener processes it. The event.target ensures the click is handled only if the li element was clicked.

Benefits of Event Delegation

  1. Improved Performance: Attaching a single event listener to a parent element is more efficient than adding individual listeners to multiple child elements, especially in scenarios with dynamically generated content.
  2. Dynamic Handling: Event delegation is ideal for handling events on elements that may not exist at the time the listener is added. As new child elements are dynamically added to the DOM, the parent listener continues to handle their events seamlessly.
  3. Simpler Code Management: With fewer event listeners in the code, debugging and maintaining the application becomes more straightforward.

Common Use Cases for Event Delegation

  • Dynamic Content: Managing events for items added to the DOM after the initial page load, such as in a to-do list application.
  • Lists and Tables: Handling click events on large data tables or lists efficiently.
  • Forms: Capturing input events from dynamically generated form fields.

Best Practices for Event Delegation

  • Use Specific Selectors: Ensure the event.target check is precise to avoid unintended behavior.
  • Minimize Listener Scope: Attach listeners to the closest common ancestor of the elements you want to manage.
  • Avoid Overuse: While event delegation is powerful, excessive reliance on it for deeply nested structures can make debugging challenging.

Conclusion

Event delegation is a cornerstone technique in modern web development, offering a scalable and efficient way to manage events across dynamic content. By understanding how it works and applying it judiciously, you can build applications that are both performant and maintainable. Start leveraging event delegation in your projects today to simplify your code and enhance user interactions.

Published by
February 27, 2025 9:46 am

Comments are closed here.


Creative

I studied Digital Media for 12 months at Mt Druitt TAFE. While  doing so we studied The 3D Modeling Program ‘Maya’. During the course I produced a number of 3D scenes and a couple of 3D animated movies.

I have also played in other programs such as Bryce 3D, 3D Studio Max, Lightwave, Vue D’esprit and a few others. However, i have always returned to Maya as a personal preference.

Bellow are a number of works that i have produced from these various programs.

Bryce 3D: Balls

Vue D’esprit: Sulfuric

Maya: Living Room

Maya: Gauntlet

Loading...