Re: xlink:href test case

On Apr 16, 2010, at 06:56 , Anne van Kesteren wrote:
> On Fri, 16 Apr 2010 00:55:16 +0900, Robin Berjon <> wrote:
>> It's annoying that this produces different results across browsers though, the error handling should hopefully be the same (which as Erik noted is partly an issue with DOM 3 Core).
> setAttribute() should probably be defined to either override the value of an attribute that matches the "tag name" given or set an attribute that is not in a namespace if there is no such attribute currently.

I'm okay with the first, but the second is a problem because if the prefix is unbound the document cannot then be serialised to XML. The following might work:

Given setAttribute("foo:bar", "unidahut"),

  - if there is an attribute the qualified name of which is "foo:bar", its value gets updated
  - if there is no such attribute, but there is a namespace in scope for prefix "foo", then a foo:bar attribute is created with that prefix and that namespace
  - if there is no such attribute and no matching namespace in scope, a "bar" attribute is created, with no prefix and in no namespace

But I guess that's a topic for DOM 4 Core to address.

Robin Berjon -

Received on Friday, 16 April 2010 08:33:02 UTC