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

[whatwg] DOMTokenList feedback

From: Sylvain Pasche <sylvain.pasche@gmail.com>
Date: Mon, 06 Jul 2009 22:30:29 +0200
Message-ID: <4A525EE5.9030006@gmail.com>
On 7/6/2009 9:08 AM, Kristof Zelechovski wrote:
> Regarding DOMTokenList, why not:
> 	contains(""): true
> 	add,remove,toggle(""): no effect?

That could be an option. There is already a INVALID_CHARACTER_ERR 
exception thrown if the token contains spaces. So I think it would be 
consistent to throw an exception if the token is empty, following the 
rule "invalid tokens raise exception" (and considering empty tokens as 

> Are there situations that would require an exception to be thrown, or else
> the page would go out in a blast?

Hard to say, but calling these functions with empty tokens certainly 
means there is a bug somewhere and throwing an exception in that case 
could help authors identify the issue when it happens.

Received on Monday, 6 July 2009 13:30:29 UTC

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