0

How do you select element with namespace with jQuery > 3.0.0 ?

It looks like jQuery selecting a selector with namespaced element doesn't work anymore. (Or I don't use it correctly)

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" xml:base="https://portal.foo.fr/sites/foo/_api/">    
  <entry>
    <content type="application/xml">
      <m:properties>
        <d:Title>titre</d:Title>
  • $("Title") => OK 1 item
  • $("d\\:Title") => KO 0 item
  • $("d\\\:Title") => KO 0 item
  • $("properties Title") => KO 0 item
  • $("content Title") => OK 1 item
  • $("content properties Title") => KO 0 item

It looks like protection with \ doesn't work at all. OK I'll be more than happy if I can ignore the namespace. But this doesn't work either. "grandfather child" works. But not "father child" or "grandfather father child"

https://jsfiddle.net/qhgobLen/2/

Community
  • 1
  • 1
frenchone
  • 1,547
  • 4
  • 19
  • 34
  • hmm... isn't your \ on the wrong side? – Kevin B Nov 28 '16 at 22:42
  • https://jsfiddle.net/00fyL0bd/1/ – Kevin B Nov 28 '16 at 22:54
  • as an aside, the question you linked to was posted in january 2010, the user was likely using jquery 1.3.2. That was a loooong time ago in the programming world. it has gone through quite a few changes between now and then, so undoubtably things have changed, both in jQuery and the browser's dom api. – Kevin B Nov 28 '16 at 23:21
  • @Kevin B. Yes it was. But even with the backslash on the right (or rather left) side it still doesn't work . Thank you for your fiddle. I created mine frome yours. – frenchone Nov 29 '16 at 09:21

0 Answers0