Monday, May 30, 2011

Javascript study notes

There are 2 levels of event handler model.
For level 0, We can only set the event handler as an attribute of an element.
For level 2, We can register many handlers to the same element.

We use two function addEventListener( ) and removeEventListener( )
1. Event Propagation
First, during the capturing phase, events propagate from the Document object down through the document tree to the target node.
The next phase of event propagation occurs at the target node itself.
The third phase of event propagation is the bubbling phase, in which the event propagates or bubbles back up the document hierarchy from the target element up to the Document object.
2.If registerd many handler on same element for same event, We could never grantee the order of handler invoked.
3. if you register the same handler function more than once on the same element, all registrations after the first are ignored.

No comments: