$ .data在Chrome中随机返回undefined返回。 Rails App

时间:2017-03-23 19:25:57

标签: javascript jquery ruby-on-rails google-chrome

我遇到了一个我无法弄清楚的严重问题。出于某种原因,调用$ .data会随机决定在Chrome中返回false。似乎在FireFox和Safari中工作正常。我找不到任何模式,似乎没有任何东西与来自后端的数据有关,并且创建JS对象的所有数据都很好,但创建对象将失败。任何帮助将是超级赞赏!!谢谢!!

$j('#search_results div.actor .placeholder img').click(function(obj){
  if(obj.target.tagName.toUpperCase()=="A" || $j(obj.target).parents('A').length>0){return true;}

  var actor=$j(this);
  if(!actor.hasClass('actor')){
    actor = actor.parents('.actor');
  }

  var data=$j.data(actor.get(0), 'data');

$(actor).get(0)返回一个包含所述actor数据的对象。

<div id="actor_3484" class="actor already_submitted selected multiple_headshots" href="/p/3484/x0bugnxb2jl43mj4jpvd204muijvr6" actor_id="3484" search_text="
				 
	          
	            

	          

	           
	          

	          
	            

  .fa {
    margin-left: 17.5px;
    background: #dfdfdf;
    color: #6d6d6d;
    max-width: 20px;
    min-width: 20px;
    max-height: 15px;
    min-height: 15px;
    padding-top: 4px;
    text-align: center;
    border: 1px solid #b7b6b6;
    border-radius: 2px;
    color: #9a9999;
    font-size: 11.5px;
  }

  .actor_actions .fa:hover, .search_results_actions_left .fa:hover {
    background: #396daa;
    color: white;
  }

  .fa-file-text-o:hover {background: #dfdfdf!important; color: #6d6d6d!important;}

  .favorite_actor:hover, .favorited {background: #18c4a3!important; color: white!important;}


  a {
    text-decoration: none;
  }

  .actor_actions {
    left: 117.5px!important;
  }

  .actor-selector-bg {
    margin-left: 17.5px!important;
    max-width: 20px!important;
    min-width: 20px!important;
    border: 1px solid #c1c0c0;
    background: #dfdfdf!important;
  }

  .actor-selector {
    margin-left: 1px!important;
  }

  .fa-user {
    color: white!important;
    font-size:10px;
    margin-top: -2px;
  }

  .premium_plus, .premium_plus:hover {background-color: #fbb03a!important; color: white;}
  .premium, .premium:hover {background-color: #3c86b6!important; color: white;}
  .basic, .basic:hover {background-color: #828e97!important;}

  .r_n_p {
    background: #396daa!important;
    color: white!important;
  }

  .fa-usd:hover {background: #ad1f1f!important; color: white!important;}
  .overscale {background: #ad1f1f!important; color: white!important;}

  .black, .black:hover {background-color: black!important; color: white!important;}
  .blue, .blue:hover {background-color: #396daa!important; color: white!important;}
  .green, .green:hover {background-color: #35ac48!important; color: white!important;}
  .red, .red:hover {background-color: #ac364f!important; color: white!important;}
  .dark_gray {color: #6d6d6d;}

  .gray_cam {
    opacity: .5;
    cursor: default;
  }
  .gray_cam:hover {
    background-color: #dfdfdf!important;
    color: gray!important;
  }

  .fa-upload:hover {
    background-color: #65bf92!important;
    color: white!important;
  }

  .has_sub_vid {
    background-color: #65bf92;
    color: white!important;
  }
  .has_sub_vid:hover {
    background-color: #65bf92!important;
  }

  .repd {
    background: #ac364f;
    color: white;
  }

  .info_btn {
    font-size: 16px;
  }
  .i {
    position: absolute;
    margin: -2px 0 0 -2px;
  }



i
  E
P

  


  
    N
  

  
    
  


  



    
      
      
    



  $(document).ready(function(){
    $.each($(&quot;.info_link_actor_3484&quot;), function(i,v){
      $(v).attr('href', &quot;/agent_account/search/actor_update_stats?id=3484&amp;search[f_project_id]=6380&amp;amp;role_id=17461&quot;)
    });
  });




	          
	          
	        


	        
	          
  .fa {
    display: block;
  }
  .search_results_actions_left {
    margin-left: -3px;
  }

  .bookout_button:hover {background: #ad1f1f!important; color: white!important;}

  .actor_booked {background: #ad1f1f!important; color: white!important;}
  .red_text {color: #ac364f;}








  F


  

    M


    U

    
      B


  
    
    
  

	        
	        
	            
  Abbott, Felicita



  NU
  
    6' 155lbs
    ON HOLD
  
  


    
      Already submitted for:
      Jenny
    








	        
	      ">
				 <div class="placeholder ">
	          <div class="polaroid_holder">
	            <img class="actor_headshot" actor_id="3484" headshot_id="2106822" src="http://localhost:3000/images/headshot_pending_generic.jpg" width="121" original_ratio="1.4" height="170">

	          </div>

	           <div class="actor_update_stats" id="actor_update_stats_3484" style="display:none;">
	          </div>

	          <div id="" class="actor_actions search_results_actions_left ">
	            <style>

  .fa {
    margin-left: 17.5px;
    background: #dfdfdf;
    color: #6d6d6d;
    max-width: 20px;
    min-width: 20px;
    max-height: 15px;
    min-height: 15px;
    padding-top: 4px;
    text-align: center;
    border: 1px solid #b7b6b6;
    border-radius: 2px;
    color: #9a9999;
    font-size: 11.5px;
  }

  .actor_actions .fa:hover, .search_results_actions_left .fa:hover {
    background: #396daa;
    color: white;
  }

  .fa-file-text-o:hover {background: #dfdfdf!important; color: #6d6d6d!important;}

  .favorite_actor:hover, .favorited {background: #18c4a3!important; color: white!important;}


  a {
    text-decoration: none;
  }

  .actor_actions {
    left: 117.5px!important;
  }

  .actor-selector-bg {
    margin-left: 17.5px!important;
    max-width: 20px!important;
    min-width: 20px!important;
    border: 1px solid #c1c0c0;
    background: #dfdfdf!important;
  }

  .actor-selector {
    margin-left: 1px!important;
  }

  .fa-user {
    color: white!important;
    font-size:10px;
    margin-top: -2px;
  }

  .premium_plus, .premium_plus:hover {background-color: #fbb03a!important; color: white;}
  .premium, .premium:hover {background-color: #3c86b6!important; color: white;}
  .basic, .basic:hover {background-color: #828e97!important;}

  .r_n_p {
    background: #396daa!important;
    color: white!important;
  }

  .fa-usd:hover {background: #ad1f1f!important; color: white!important;}
  .overscale {background: #ad1f1f!important; color: white!important;}

  .black, .black:hover {background-color: black!important; color: white!important;}
  .blue, .blue:hover {background-color: #396daa!important; color: white!important;}
  .green, .green:hover {background-color: #35ac48!important; color: white!important;}
  .red, .red:hover {background-color: #ac364f!important; color: white!important;}
  .dark_gray {color: #6d6d6d;}

  .gray_cam {
    opacity: .5;
    cursor: default;
  }
  .gray_cam:hover {
    background-color: #dfdfdf!important;
    color: gray!important;
  }

  .fa-upload:hover {
    background-color: #65bf92!important;
    color: white!important;
  }

  .has_sub_vid {
    background-color: #65bf92;
    color: white!important;
  }
  .has_sub_vid:hover {
    background-color: #65bf92!important;
  }

  .repd {
    background: #ac364f;
    color: white;
  }

  .info_btn {
    font-size: 16px;
  }
  .i {
    position: absolute;
    margin: -2px 0 0 -2px;
  }

</style>

<a href="/agent_account/search/actor_update_stats?id=3484&amp;search[f_project_id]=6380&amp;amp;role_id=17461" class="fancybox info_link info_link_actor_3484"><i class="fa letters info_btn"><span class="i">i</span></i></a>
  <a href="/agent_account/edit_actor/3484" target="_blank"><i class="fa letters" aria-hidden="true" style="font-size: 11px;">E</i></a>
<a href="javascript: (function(){window.open('/p/3484/x0bugnxb2jl43mj4jpvd204muijvr6', 'actor_popup_window','height=870,width=1200,scrollbars=1,resizable=0,status=0')})();"><i class="fa letters" aria-hidden="true" style="font-size: 11px;">P</i></a>

  <a href="/agent_account/actors/3484/email_profile_form?height=275&amp;width=650" class="fancybox"><i class="fa fa-share" aria-hidden="true"></i></a>


  <a href="/agent_account/submissions/288574/actors/3484/note?width=350&amp;height=200&amp;fancybox=1" always_hover="note" class="note fancybox">
    <i class="fa letters right_note " aria-hidden="true">N</i>
  </a>

  <a href="#" class="overscale flip_attribute" always_hover="overscale">
    <i class="fa fa-usd previously_overscale" aria-hidden="true"></i>
  </a>


  <!-- <a href="#" title="Click here to mark this actor as a special selection. You can only have ten special selections." class="special flip_attribute" always_hover="special"><img src="/images/layout/search/special.png"></a> -->



    <a href="/agent_account/submissions/288574/actors/3484/headshots?width=650&amp;height=450&amp;role_id=17461" class="thickbox " always_hover="multiple_headshots">
      <!-- <img class="autohover more_pictures disabled_action" src="/images/layout/search/more_pictures.png" alt="More pictures" /> -->
      <i class="fa fa-camera-retro" aria-hidden="true"></i>
    </a>


<script>
  $(document).ready(function(){
    $.each($(".info_link_actor_3484"), function(i,v){
      $(v).attr('href', "/agent_account/search/actor_update_stats?id=3484&search[f_project_id]=6380&amp;role_id=17461")
    });
  });
</script>



	          </div>
	          <br clear="all">
	        </div>


	        <div class="search_results_actions_left ">
	          <style>
  .fa {
    display: block;
  }
  .search_results_actions_left {
    margin-left: -3px;
  }

  .bookout_button:hover {background: #ad1f1f!important; color: white!important;}

  .actor_booked {background: #ad1f1f!important; color: white!important;}
  .red_text {color: #ac364f;}

</style>






  <a href="http://localhost:3000/agent_account/actors/3484/favorites?width=400&amp;height=220&amp;agent_id=392" class="fancybox"><i class="fa letters favorite_actor " aria-hidden="true" style="font-size: 11px;">F</i></a>


  <a href="mailto:lolita.heathcote@lemke.biz"><i class="fa fa-envelope-o" aria-hidden="true"></i></a>

    <a href="/agent_account/submissions/288574/actors/3484/edit?height=170&amp;width=355&amp;refresh=false" class="change_role fancybox"><i class="fa letters" aria-hidden="true">M</i></a>


    <a id="unsubmit_3484" onclick="unsubmit('/agent_account/submissions/unsubmit.288574', 392, 1978392, 3484, 288574, 17461); return false;" href="#"><i class="fa letters" aria-hidden="true">U</i></a>

    <a href="/agent_account/submissions/288574/actors/3484/book_outs?width=350&amp;height=200" class="books_out fancybox">
      <i class="fa letters bookout_button " aria-hidden="true">B</i>
</a>

  <a href="/agent_account/actor_agent_relationships/3484/edit?height=275&amp;width=650" class="fancybox edit_note">
    <!-- <img src="/images/layout/search/privatenote_gray.png" alt="Privatenote gray" /> -->
    <i class="fa fa-file-text-o " aria-hidden="true"></i>
  </a>

	        </div>
	        <div class="search_results_info">
	            <p style="font-size:15px;">
  Abbott, Felicita
</p>

<p>
  <small><span class="dark_gray" title="Non-union">NU</span></small>
  </p><p class="dark_gray">
    6' 155lbs
    </p><div class="red_text">ON HOLD</div>
  <p></p>
  <p></p>
<p></p>

    <p style="color:red;">
      Already submitted for:<br>
      <a class="thickbox" href="http://localhost:3000/agent_account/projects/6380/roles/17465/popup_info?KeepThis=true">Jenny</a>
    </p>








	        </div>
	      </div>

再次感谢你!

0 个答案:

没有答案