[whatwg] DOMTokenList feedback

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 
invalid).

> 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.

Sylvain

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