Sunday, January 9, 2011

several of these on the blog but invite you to check out the Release Notes for a complete set

To avoid this, you should use a technique called event delegation. Event delegation refers to the use

of a single event listener on a parent element to listen for events happening on its children. To

achieve this, we can rely on the fact that browsers bubble up events to their parents until they reach

the window object.

An added benefit to event delegation is the fact that when we add new children to the parent, they will

automatically start triggering our events. Also, when you remove children from the parent, you don’t

have to clean up all the event listeners to avoid memory leaks. This is actually what happened in the

Sencha Touch application that I mentioned at the beginning of the article. Many items in their Lists

were being removed, but the inline event handlers weren’t being cleaned up, causing crashes on the

iPad.

In Sencha Touch, we provide developers with ways to easily achieve event delegation. Let’s look at a

simple scenario. Suppose we have the following DOM structure somewhere on the page:



300 Enhancements & Bug Fixes

Since 0.90 almost 300 enhancements and bug fixes have gone into Sencha Touch, ranging from improvements

to the efficiency of layouts and rendering to enhancements in the data package. We’ve mentioned

several of these on the blog but invite you to check out the Release Notes for a complete set.

Improved Documentation

No comments:

Post a Comment