On Thu, April 16, 2009 1:20 am, DBJDBJ wrote: > > If I do this : > > $("head").prepend("<dbj:root xmlns=dbj:'dbj.org.schema' ></ > dbj:root>") > > how do I then select dbj:root by tag name ? > > A: $("dbj:root") > > B: $("dbj\:root") > > C: $("root") > > Any idea anyone ?
jQuery selectors are not namespace-aware, so they only use getElementsByTagName (rather than getElementsByTagNameNS) to retrieve elements by their nodeName attribute (rather than by localName and namespaceURI). The example you give will work using: $("dbj\\:root") but be aware that an XML-savvy browser such as Firefox will treat your namespaced XML elements differently to XHTML elements, such that various other selectors won't work. For example, $("head").prepend("<dbj:root xmlns=dbj:'dbj.org.schema' class="foo"></dbj:root>") would not allow you to retrieve the <dbj:root/> element using $(".foo") or $("dbj\\:root.foo"), as the XML element won't have the XHTML className property. Regards, Nick. -- Nick Fitzsimons http://www.nickfitz.co.uk/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---