title: jQuery Mobile 1.3 Panel Not Working After Page Change
body: <p>I seem to be having issues with programmatic opening and closing of a JQM 1.3 Panel. </p>
  
  <p><strong>EDIT: This is for JQM 1.3.x not 1.4+</strong></p>
  
  <p>It is somewhat hard to explain, so I just made a fiddle :)</p>
  
  <p>There is a lot going on in the fiddle, but it is just a sample of a much larger app and conveys the issue.</p>
  
  <p>How to replicate:</p>
  
  <ol>
  <li>Go to Fiddle </li>
  <li>On Fiddle open the Panel and go to Page Two</li>
  <li>On Page Two open Panel and go to Page One</li>
  <li>Try to Open the Panel now on page one, it does nothing.</li>
  </ol>
  
  <p>Browsers Affected:</p>
  
  <p><strong>EDIT:</strong> This seems to be fixed in Chrome 30.0.1599.101 m</p>
  
  <ul>
  <li>Chrome 28.0.1500.95 m</li>
  <li>IE 10.0.9200.16635</li>
  <li>Safari // Latest Ver</li>
  <li>Android WebView (4.2.2) </li>
  </ul>
  
  <p>Browsers NOT Affected:</p>
  
  <ul>
  <li>Firefox 23</li>
  <li>Opera 12.16</li>
  </ul>
  
  <p><strong>Link to Fiddle:</strong></p>
  
  <p><a href="http://jsfiddle.net/q2YH3/" rel="nofollow noreferrer">http://jsfiddle.net/q2YH3/</a></p>
  
  <p><em>Link to Other Posts</em></p>
  
  <p><a href="https://github.com/jquery/jquery-mobile/issues/6308" rel="nofollow noreferrer">https://github.com/jquery/jquery-mobile/issues/6308</a></p>
  
  <p><a href="http://forum.jquery.com/topic/panel-not-responding-after-page-change" rel="nofollow noreferrer">http://forum.jquery.com/topic/panel-not-responding-after-page-change</a></p>
  
  <p><strong>EDIT:</strong> So Firefox gives me an error that neither Chrome or IE do. </p>
  
  <p>When I click to go back to page one, I get:</p>
  
  <p><code>
  Type Error: elem is undefined
  </code></p>
  
  <p>The error is thrown by JQ 1.9.1, I trace it back to this:</p>
  
  <pre><code>A method for determining if a DOM node can handle the data expando
      acceptData: function( elem ) {
          // Do not set data on non-element because it will not be cleared (#8335).
          if ( elem.nodeType &amp;&amp; elem.nodeType !== 1 &amp;&amp; elem.nodeType !== 9 ) {
              return false;
          }
  
          var noData = elem.nodeName &amp;&amp; jQuery.noData[ elem.nodeName.toLowerCase() ];
  
          // nodes accept data unless otherwise specified; rejection can be conditional
          return !noData || noData !== true &amp;&amp; elem.getAttribute("classid") === noData;
      }
  `
  </code></pre>
  
  <p>Note the : </p>
  
  <p><strong>Do not set data on non-element because it will not be cleared (#8335).</strong></p>
  
  <p>Github Issue Link:
  <a href="https://github.com/jquery/jquery/pull/1232" rel="nofollow noreferrer">https://github.com/jquery/jquery/pull/1232</a></p>
  
  <p>OG Code:</p>
  
  <pre><code>$('.showMenu').on('click', function(){
  $.mobile.loading('hide');
  $.mobile.activePage.find('#'+$.mobile.activePage.attr('id')+'P').panel("toggle");
  });
  
  $('.btnMenuItem').on('click', function(event){
  myPgActions.nav(event, function(target){
      $.mobile.changePage(target);
  }, false);
  });   
  
  var myPgActions = {};
  
  myPgActions = {
  nav: function(event, callback, manualHash){
      var PID = $.mobile.activePage.attr('id'),
      target = (!!event) ? event.target.name : manualHash;    
      $("#"+PID+"P").panel( "close" );
      if(PID != 'loading') $("#"+PID+"Iframe").hide();        
  
      if(PID == target){
          $("#"+PID+"Iframe").hide('fast', function(){
              $("#"+PID+"Iframe").attr('src', "");
  
              myPgActions.update(PID, target, 'refresh', function(target){
                  callback(target)
              });
          }); 
  
      }else{
  
          this.update(PID, target, 'change', function(target){
              callback(target);
          });
  
      }
  
  },// end get
  
  update: function(PID, target, type, updateCallback){
  
      var ifReady = $.Deferred();
  
      if(type == 'refresh'){
  
          this.buildUrl(PID, function(url){
  
              $('#'+PID+'Iframe').attr( 'src', url);
              ifReady.resolve();          
  
              $.when(ifReady).then(function(){
                  updateCallback('#'+PID+'Iframe')        
              });
          });
  
      }else if(type == 'change'){
  
          this.buildUrl(target, function(url){
              $('#'+target+'Iframe').attr( 'src', url);
              ifReady.resolve();
          });
  
          $.when(ifReady).then(function(){
              updateCallback('#'+target); 
          });
      }
  }, // end set
  buildUrl: function(page, buildCallback){
      switch(page){
          case 'dash':        
              var mobileSiteUrl = 'URL with options for iframe'
              setTimeout(function(){buildCallback(mobileSiteUrl);},25);
          break;
          case 'local':
              var mobileSiteUrl = 'URL with options for iframe'
              setTimeout(function(){buildCallback(mobileSiteUrl);},25);   
          break;
  
  
      }// End Switch
  }
  }// End Obj
  </code></pre>