Whenever I call xml.setNamespace(ns), the namespace of the element is set to ns, but ns is also added as another namespace with it's own prefix to the element. I would like to know how to stop the latter from happening (I'm okay with modifying XML.prototype.function::setNamespace) without defining @xmlns as I can't use E4X syntax. Alternatively, an XML.prototype.function::setAttribute that doesn't use E4X @attribute syntax (except of course for the one use of function:: for defining it) would be even better.
Example:
var xhtml = new Namespace("http://www.w3.org/1999/xhtml"),
xml = <foo/>;
xml.setNamespace(xhtml);
// what I get:
xml.toXMLString() ===
<foo
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns="http://www.w3.org/1999/xhtml"
/>.toXMLString();
// what I want:
xml.toXMLString() ===
<foo
xmlns="http://www.w3.org/1999/xhtml"
/>.toXMLString();