0

Ok, so I'm not really sure where to begin here.

In my controller I have a function like this:

  $scope.newEle = function(e){
      if(! angular.element(e.srcElement).hasClass('existing')){
        var width = (window.innerWidth-700)/2;
        if($scope.items[0]){
          $scope.e = jQuery.extend({}, $scope.items[0]); 
        }else{
          $scope.e = {}; 
        }
      }
    };

This function is on a giant div. The div has items located in different spots within.

When you double click an item within the div (or empty space within the div itself), if it has the class 'existing' it shouldn't do anything, but if the item doesn't have the class - the function should continue.

This works in chrome, but not firefox.

The working example is http://engine404prod.herokuapp.com

Any ideas?

Elliot
  • 13,580
  • 29
  • 82
  • 118
  • All I can see in FF is that e.srcElement is undefined when you dbl-click an existing element. Can you reduce the code to a smaller, more manageable sample ? – Luc Morin Mar 05 '13 at 00:48

2 Answers2

1

Just for the sake of completeness, the SO post that Elliot linked to states that one should use the following code:

var target = event.target || event.srcElement;

This will work in all browsers.

Cheers

Luc Morin
  • 5,302
  • 20
  • 39
0

For future reference - srcElement doesn't work in FF. Thanks to @mclurmorin for helping - How can I make event.srcElement work in Firefox and what does it mean?

Community
  • 1
  • 1
Elliot
  • 13,580
  • 29
  • 82
  • 118