I think xmlns:* shows up in element.attributes in Firefox and Safari even in xhtml+xml mode

Hi folks,

I have an action to update my JS code [1] to work in documents delivered
with the XHTML mime type.

I ported my home page to XHTML (just removed a few undeclared entities):

  http://ben.adida.net/index.xhtml

and, to my pleasant surprise, in both Safari 4 and Firefox 3.5, it
appears that xmlns:* declarations are present in the DOM, right in
element.attributes.

I'd love it if someone could confirm this for me, just in case I'm
missing something. Here's how you can help:

- go to
http://ben.adida.net/index.xhtml

make sure you've got the right MIME type delivered application/xhtml+xml

- invoke the GetN3 bookmarklet, which you can install here:
http://www.w3.org/2006/07/SWD/RDFa/impl/js/

see the triples? That's pretty good news.

- not convinced yet? go back to
http://ben.adida.net/index.xhtml

- paste this into the URL:
javascript:alert(document.getElementsByTagName('body')[0].attributes[0].name)

Do you get a popup that says "xmlns:dc" ?

- it gets better, it looks like it's even in the DOM function call, try
pasting:

javascript:alert(document.getElementsByTagName('body')[0].getAttribute('xmlns:dc'))

Unless I've made a weird mistake, it looks like the latest versions of
Safari and Firefox are happy to return the xmlns:* declarations as
normal attributes.

-Ben

[1] http://rdfa.info/wiki/Rdfa-implementors-guide

Received on Thursday, 24 September 2009 00:30:41 UTC