2012년 7월 16일 월요일

javascript addEventListener - Capturing, Bubbling - stopPropagation

http://help.dottoro.com/ljeuqqoq.php

element.addEventLister('name',function,bubbling) 

bubbling - true/false
true : bubbling
false : capturing.

* web event propagation basic

--------->----------->-------->-------->---->------- capturing

(window-document )- body - ... - listening element ...listening element           |
<--------<----------<------------<-------------<----- bubbling


function someListeningFunction(evt)
{
   ............
   // event should not be passed any more.
   evt.stopPropagation();
}

To make something complicated functionality composed with many elements,
event propagation need to be same and should be stop at right point.

댓글 없음:

댓글 쓰기