File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -707,7 +707,7 @@ CompilerProto.addListener = function (listener) {
707707 target
708708 while ( i -- ) {
709709 target = delegator . targets [ i ]
710- if ( e . target === target . el && target . handler ) {
710+ if ( target . el . contains ( e . target ) && target . handler ) {
711711 target . handler ( e )
712712 }
713713 }
Original file line number Diff line number Diff line change @@ -490,6 +490,17 @@ describe('UNIT: Directives', function () {
490490 assert . ok ( triggered )
491491 } )
492492
493+ it ( 'delegation should work' , function ( ) {
494+ var triggered = false ,
495+ child = document . createElement ( 'div' )
496+ dir . el . appendChild ( child )
497+ dir . update ( function ( ) {
498+ triggered = true
499+ } )
500+ child . dispatchEvent ( mockMouseEvent ( 'click' ) )
501+ assert . ok ( triggered )
502+ } )
503+
493504 it ( 'should wrap the handler to supply expected args' , function ( ) {
494505 var vm = dir . binding . compiler . vm , // owner VM
495506 e = mockMouseEvent ( 'click' ) , // original event
You can’t perform that action at this time.
0 commit comments