Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/475.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Angularjs dbl单击在chrome中工作,但不是firefox_Javascript_Firefox_Cross Browser_Angularjs - Fatal编程技术网

Javascript Angularjs dbl单击在chrome中工作,但不是firefox

Javascript Angularjs dbl单击在chrome中工作,但不是firefox,javascript,firefox,cross-browser,angularjs,Javascript,Firefox,Cross Browser,Angularjs,好的,所以我不确定从哪里开始 在我的控制器中,我有如下功能: $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.it

好的,所以我不确定从哪里开始

在我的控制器中,我有如下功能:

  $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 = {}; 
        }
      }
    };
此功能位于一个巨大的分区上。分区内的项目位于不同的位置

双击div中的某个项(或div本身中的空白)时,如果该项具有“existing”类,则不应执行任何操作,但如果该项没有该类,则该函数应继续

这适用于chrome,但不适用于firefox

工作示例是


有什么想法吗?

供将来参考-SRCELENT在FF中不起作用。感谢@mclurmorin的帮助-

为了完整起见,Elliot链接到的SO帖子声明应该使用以下代码:

var target = event.target || event.srcElement;
这将适用于所有浏览器


干杯

我在FF中看到的是,当dbl单击现有元素时,e.srcElement是未定义的。您能否将代码简化为更小、更易于管理的示例?