W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2011

Re: setAttributeNS(): should it change the namespace prefix?

From: Anne van Kesteren <annevk@opera.com>
Date: Tue, 29 Nov 2011 22:49:35 +0100
To: "Boris Zbarsky" <bzbarsky@mit.edu>
Cc: "www-dom@w3.org" <www-dom@w3.org>
Message-ID: <op.v5p9kxga64w2qv@annevk-macbookpro.local>
On Tue, 29 Nov 2011 19:13:25 +0100, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 11/29/11 11:22 AM, Anne van Kesteren wrote:
>> document.head.setAttributeNS("test", "x:a", "a")
>> document.head.setAttributeNS("test", "e:a", "b")
>>
>> Should the result be an attribute "x:a" or "e:a"? Gecko says "e:a",
>> Opera/Webkit say "x:a". Making the prefix member of an attribute
>> completely immutable seems somewhat preferable to me.
>
> Why?

Mostly so we do not have to complicate mutation observers even further for  
an edge case nobody should even get to.


> Maybe our respective biases are showing here, but it seems to me like  
> this sequence of calls:
>
>    document.head.setAttributeNS("test", "x:a", "a")
>    document.head.removeAttributeNS("test", "a");
>    document.head.setAttributeNS("test", "e:a", "b")
>
> should act just like your first example.  Which it does in Gecko, but  
> not in Webkit/Opera, right?

Right. Seems to me these cases are quite different, because setAttributeNS  
does a presence test. And based on that it either creates and appends, or  
sets the value (and prefix in case of Gecko).


-- 
Anne van Kesteren
http://annevankesteren.nl/
Received on Tuesday, 29 November 2011 21:50:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:08 GMT