Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery won't select XML elements in Firefox
    primarykey
    data
    text
    <p><strong>Update: Question edited to add more information.</strong></p> <p>My app directly views XML data in a browser -- after some light client-side XSLT processing that we can assume here is just the identity transform inside a thin HTML wrapper.</p> <p></p> <pre><code>&lt;xsl:output method="xml" indent="no" encoding="utf-8" /&gt; &lt;xsl:template match ="/"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;xsl:template match="@*|node()"&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select="@*|node()"/&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;/body&gt; &lt;/html&gt; &lt;/xsl:template&gt; </code></pre> <p></p> <p>With jQuery 1.8.3, this</p> <pre><code>$("*[target]").click(function (event) { alert("click"); }); </code></pre> <p>will (or should) select elements that have a @target attribute.</p> <p>This works fine in IE and Chrome, but in Firefox jQuery won't select anything unless I change the XSLT output to "html", which messes up other things.</p> <p>What is the correct way, in Firefox, to get jQuery to select non-HTML, XML elements or -- which might be saying the same thing a different way -- to get jQuery to select custom HTML elements?</p> <p><strong>Update: Found source of problem.</strong> The selectors do not select because they are inside $(document).ready() and that does not fire for XML documents styled with XSLT (output='xml') in Firefox. Someone else with same problem: <a href="http://forum.jquery.com/topic/document-ready-with-xslt-in-xhtml" rel="nofollow">http://forum.jquery.com/topic/document-ready-with-xslt-in-xhtml</a></p> <p>I haven't found a combination of parameters and code order to get it to fire. My workaround so far is to use $(window).load() instead of $(document).ready().</p> <p><strong>More Update</strong> There is now a <strong>jQuery bug report</strong> for this, #13193. <a href="http://bugs.jquery.com/ticket/13193" rel="nofollow">http://bugs.jquery.com/ticket/13193</a></p>
    singulars
    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.
 

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