I have looked a little more, and found some behavior that puzzles me. Desespite the claim that jquery doesn't support namespaces, $("[x:\\name]") or $('[x:\\name="value"]') _does_ work to select nodes in the original dom. however, $(document).find("[x:\\name]") does not.
I had assume that find() used the same code as the basic selector, so what is causing this difference? Also, if I use jquery to _construct_ a document fragment with a namespaced attribute, then the $([attrib],fragment) selector fails to find it. So to summarize, namespaced attributes work if and only if they are defined in the dom and found using $([attrib]) instead of $().find ([attrib]). Why is this? Test code enclosed: <html> <head> <title>Test</title> <script src="http://jqueryjs.googlecode.com/files/ jquery-1.3.2.js"></script> </head> <body> <B>Fragments for tests:</B> <div id="fragments"> <div id="indom"> <div ex:method="indom"> this was a namespaced in-DOM div </div> </div> <div id="indom-safe"> <div safe="indom"> this was a safe in-DOM div </div> </div> </div> <B>Testing $('[attrib]'):</B> <div id="select-exist"></div> <B>Testing $("#id").find("[attrib]") etc:</B> <div id="find-exist"></div> <script> var written=$('<div><div id="written"><div ex:method="written">this was a namespaced jquery-written fragment</div></div></div>'); var writtenSafe=$('<div><div id="written-safe"><div safe="written">this was a safe jquery-written fragment</div></div></ div>'); var selectInSafe=$('[safe]'); var selectIn=$('[ex\\:method]'); var selectWrittenSafe=$('[safe]',writtenSafe); var selectWritten=$('[ex\\:method]',written); var findInSafe=$("#indom-safe").find('[safe]'); var findIn=$("#indom").find('[ex\\:method]'); var findWrittenSafe=writtenSafe.find('[safe]'); var findWritten=written.find('[ex\\:method]'); $("#select-exist") .append(selectInSafe.clone()) .append(selectWrittenSafe.clone()) .append(selectIn.clone()) .append(selectWritten.clone()); $("#find-exist") .append(findInSafe.clone()) .append(findWrittenSafe.clone()) .append(findIn.clone()) .append(findWritten.clone()); written.children().clone().appendTo("#fragments"); writtenSafe.children().clone().appendTo("#fragments"); </script> </body> On Aug 10, 11:15 am, David <kar...@csail.mit.edu> wrote: > thanks; this is helpful. > > On Aug 10, 3:52 am, DBJDBJ <dbj...@gmail.com> wrote: > > > var $xml = $("<x:root xmlns:x='uri' xmlns:y='uir2' ><x:node > > x:name='n1'>No </x:node><y:node>namespaces</y:node></x:root>"); > > > $xml.find("*[x:name=n1]").length < 1 > > /* > > Syntax error, unrecognized expression: [x:name=n1] > > */ > > $xml.find("*[x\\:name=n1]").length < 1 > > /* > > true > > */ > > $xml.find("*[name=n1]").length < 1 > > /* > > true > > */ > > Therefore : > > 1. *Sizzle* does not support namespaces in selector syntax > > 2. for node selectors namespaces will be ignored > > 3. for attribute selectors namespaces are provoking error . silent or > > not. > > > Please see this > > too:http://groups.google.com/group/sizzlejs/browse_thread/thread/48ef4372... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---