#NEWLINE# def catchEvents( self , name , object ) : #NEWLINE# #INDENT# JS ( '\n        var tmp = function(e) {\n            var targ;\n            if (!e) var e = $wnd.event;\n            if (e.target) targ = e.target;\n            else if (e.srcElement) targ = e.srcElement;\n            if (targ.nodeType == 3) targ = targ.parentNode;\n            if (targ.__ref)\n                @{{object}}.dom_event(e, targ.__ref);\n            else\n                @{{object}}.dom_event(e, null);\n        };\n        ' ) #NEWLINE# name = name [ 0 ] #NEWLINE# self . activeEvents . append ( ( name , object ) ) #NEWLINE# JS ( "\n        var old_callback = this.element['on'+@{{name}}];\n        this.element['on'+@{{name}}] = function(e){if(old_callback){old_callback(e);}@{{!tmp}}(e);};\n        " )