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?

1
  • 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 ? Commented Mar 5, 2013 at 0:48

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

Comments

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?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.