Created attachment 546310 [details] test case The test I am going to attach is an XHTML (application/xhtml+xml) document that uses document.createElementNS('http://www.w3.org/1999/xhtml', 'div') to create a new XHTML div element. It then tests element.isDefaultNamespace(element.namespaceURI) and element.lookupNamespaceURI(element.prefix) twice, once before appending the element to the document's body, once after appending the element. With Safari 5, Opera 11.5, Chrome 12 the result of those two function calls are "true" and "http://www.w3.org/1999/xhtml" both before and after inserting the element into the DOM tree. With Firefox (tested with latest release version 5 as well as with a current nightly 8.0a1 (2011-07-15)) the results differ, before the element is inserted isDefaultNamespace returns "false", lookupNamespaceURI returns "null". After the insertion into the DOM tree the results with Mozilla are the same as with other browsers. Looking at http://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#lookupNamespaceURIAlgo it seems that element.lookupNamespaceURI(element.prefix) where prefix is "null" should return the element's namespace, independent of the element having any ancestor nodes or not. So this looks like a bug in Mozilla's DOM implementation.
I have also now tested with IE 9, it behaves the same as Safari, Opera and Chrome.