Update: Question edited to add more information.
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.
<xsl:output method="xml" indent="no" encoding="utf-8" />
<xsl:template match ="/">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
</head>
<body>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</body>
</html>
</xsl:template>
With jQuery 1.8.3, this
$("*[target]").click(function (event) {
alert("click");
});
will (or should) select elements that have a @target attribute.
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.
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?
Update: Found source of problem. 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: http://forum.jquery.com/topic/document-ready-with-xslt-in-xhtml
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().
More Update There is now a jQuery bug report for this, #13193. http://bugs.jquery.com/ticket/13193
Wrap jQuery code in
instead of
This will delay availability of the jQuery bindings, but they will get made
jQuery team has accepted this as a bug. http://bugs.jquery.com/ticket/13193
Switch back to
$(document).readyonce the bug is fixed.