File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -238,8 +238,11 @@ def show_heatmap(path,type = false)
238238  heatmapInstance.addData(data_xpath); 
239239  var scroll = JSON.parse('#{ raw ( @scroll_data . to_json . html_safe ) }  '); 
240240  var scroll_data = scroll.map(function(element){ 
241-     width = getElement(element.xpath).getBoundingClientRect().width; 
242-     height = getElement(element.xpath).getBoundingClientRect().height; 
241+     var element = getElement(element.xpath); 
242+     if (!element) 
243+       return; 
244+     width = element.getBoundingClientRect().width; 
245+     height = element.getBoundingClientRect().height; 
243246    dot = document.createElement('div'); 
244247    dot.className = "dot"; 
245248    dot.style.left = (getOffset(element.xpath).x+  (width * element.offset_x)) + "px"; 
@@ -261,6 +264,7 @@ def show_heatmap(path,type = false)
261264    document.body.appendChild(dot); 
262265  }); 
263266
267+   scroll_data = scroll_data.filter(function(val){ return val!==undefined; }); 
264268</script> 
265269JS 
266270
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments