Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Event parameter not defined for Knockout click binding using Firefox

I am getting this JS error: ReferenceError: event is not defined when I try to pass the event object to click binding when I use Firefox 23. Everything works fine under Chrome

Here the code:

<!-- ko foreach: entries -->
   <tr data-bind="click: function(){ $parent.expandRow($data, event) }">
      ...
   </tr>
<!-- /ko -->


vm.entries.expandRow = function(entry, event){
    ...           
}
like image 634
Marco C Avatar asked Aug 14 '13 00:08

Marco C


1 Answers

Here the solution from github.com/knockout/knockout/issues/752

<!-- ko foreach: entries -->
   <tr data-bind="click: function(data, event){ $parent.expandRow($data, event) }">
      ...
   </tr>
<!-- /ko -->

Under Firefox event is not defined on the window object, instead it needs to be passed to the function.

like image 169
Marco C Avatar answered Oct 19 '22 18:10

Marco C