Note that there are some explanatory texts on larger screens.

plurals
  1. POSafari loading Document object instead of data with jQuery $.get method, resulting in HIERARCHY_REQUEST_ERR
    primarykey
    data
    text
    <p><strong>EDIT: I basically got things down to the fact that is necessary to use the file:// protocol to reproduce this. Also, I had Chrome launched with --allow-file-access-from-files flag. I am now using normal http protocol, so for me this question has become a bit more academic. It would be nice if it worked though, or at least someone could explain me what is going on.</strong></p> <p>Consider the following HTML (in the file "a.html"):</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Title&lt;/title&gt; &lt;meta charset="utf-8" /&gt; &lt;/head&gt; &lt;body&gt; &lt;article id="article-id"&gt; &lt;h3 class="entry-title"&gt; Title-h3 &lt;/h3&gt; &lt;div class="entry-content"&gt; &lt;/div&gt; &lt;/article&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>And I am trying to load the first child of the #article-id tag from another file (say index.html) like this:</p> <pre><code>&lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.js"&gt;&lt;/script&gt; $.get('a.html', function() { return function(data) { alert(data); var lTitle = jQuery("&lt;div&gt;").append(data) .find("#article-id :first-child").html().trim(); alert(lTitle); } }()); </code></pre> <p>In Safari 5.1.3, the first alert gives "[ object Document ]" and the next jQuery-statement throws a HIERARCHY_REQUEST_ERR.</p> <p>In Chrome 19.0.1084.54 this seems to work as expected, and I get the loaded data in the first alert, and "Title-h3" in the second alert.</p> <p>Is this a bug in jQuery or am I doing something wrong?</p> <p>Weird extra bit of information: if you add</p> <pre><code>&lt;iframe width="500" height="369" src="http://www.youtube.com/" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt; </code></pre> <p>inside the div, Safari works as Chrome.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload