title: Cannot access document's title element with jQuery (IE 8)
body: <p>I'm seeing this issue in Internet Explorer 8, but not in Safari or Firefox.  So far, I have not tested in other IE versions.</p>
  
  <p>I am developing my own jQuery plugin and, for this question, I've stripped it down to the two relevant lines.</p>
  
  <hr>
  
  <p>In IE 8, using the code below, <code>$('title').text()</code> does not do anything.  <code>docTitle</code> is blank because <code>title</code> is blank, as if the jQuery selector for <code>&lt;title&gt;</code>, <code>$('title')</code> is not working.  (Again, AFAIK, this is just in IE 8)</p>
  
  <pre><code>(function ($) {
      $.fn.myPlugin = function (options) {
  
          var title = $('title').text(),
              docTitle = escape(title);
  
      };
  })(jQuery);
  </code></pre>
  
  <p><a href="http://jsfiddle.net/sparky672/YMBQ2/" rel="nofollow">http://jsfiddle.net/sparky672/YMBQ2/</a></p>
  
  <hr>
  
  <p>However, using the plain JavaScript code below, <code>document.title</code> is working fine in everything including IE 8...</p>
  
  <pre><code>(function ($) {
      $.fn.myPlugin = function (options) {
  
          var docTitle = escape(document.title);
  
      };
  })(jQuery);
  </code></pre>
  
  <hr>
  
  <p><strong>EDIT:</strong></p>
  
  <p>It does not matter that this code is inside a plugin.</p>
  
  <p>Same result in IE 8 with this...</p>
  
  <pre><code>$(document).ready(function () {    
      var title = $('title').text();
      alert(title);
  });
  </code></pre>
  
  <p>Just to clarify, I am not insisting on using this.  In fact, I fixed my plugin by simply using <code>document.title</code> instead.  <strong>If it wasn't clear initially, I'm just asking why this does not work in IE 8.</strong></p>
  
  <hr>
  
  <p>Can anyone explain <strong>why</strong>, or what stupid mistake I may have made here?</p>
  
  <hr>
  
  <p><strong>EDIT 2:</strong></p>
  
  <p>Here are some jQuery Bug reports on this issue</p>
  
  <p><a href="http://bugs.jquery.com/ticket/7025" rel="nofollow">http://bugs.jquery.com/ticket/7025</a></p>
  
  <p><a href="http://bugs.jquery.com/ticket/5881" rel="nofollow">http://bugs.jquery.com/ticket/5881</a></p>
  
  <p><a href="http://bugs.jquery.com/ticket/2755" rel="nofollow">http://bugs.jquery.com/ticket/2755</a></p>
  
  <p>And dozens of others reporting the same thing.  The official response is to state, <em>"<code>document.title</code> is the only reliable cross-browser way and should be used instead"</em> and the Ticket is closed.  So there you go.</p>