W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2009

[whatwg] DOMTokenList: mutation clarification

From: Sylvain Pasche <sylvain.pasche@gmail.com>
Date: Thu, 09 Jul 2009 19:10:49 +0200
Message-ID: <h358b3$b6f$1@ger.gmane.org>
Hi,

1) in 
http://www.whatwg.org/specs/web-apps/current-work/#common-dom-interfaces

"When the attribute is absent, then the string represented by the object 
is the empty string; when the object mutates this empty string, the user 
agent must first add the corresponding content attribute, and then 
mutate that attribute instead"

Does it mean it should fire two DOMAttrModified events, one with the 
empty string addition, and the other with the attribute mutation?

I think it should simply fire only one mutation event in that case as in 
all other cases (should be simpler and more efficient, although that 
case shouldn't happen very often). I don't see a good reason to fire one 
with the empty string.

2) (using the class attribute for the discussion) What should happen 
when you do a remove("foo") on an element which has no class attribute?

My understanding is that it shouldn't add a class attribute with an 
empty string. That's because the remove() algorithm starts with an empty 
string and doesn't change it, so the " when the object mutates this 
empty string, " case shouldn't be true (and thus no attribute 
modification should happen).

However Simon's testcase [1] doesn't agree with this, and adds an empty 
string. So maybe it's worth clarifying this situation?


Sylvain

[1] 
http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/getting/009.htm
Received on Thursday, 9 July 2009 10:10:49 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:14 UTC