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

Re: [DOM4] Use new WebIDL [EnforceRange] attribute?

From: Anne van Kesteren <annevk@opera.com>
Date: Fri, 23 Dec 2011 16:00:50 +0100
To: www-dom@w3.org
Message-ID: <op.v6x6noin64w2qv@annevk-macbookpro.local>
On Fri, 09 Sep 2011 18:43:11 +0200, David Flanagan <dflanagan@mozilla.com>  
> WebIDL has just introduced an [EnforceRange] attribute that alters the  
> behavior of numeric conversions.  I argued for something like this using  
> CharacterData.deleteData() as an example.  In DOM Level 2, it was  
> specified to throw a TypeError for negative arguments, even though those  
> arguments were unsigned long and WebIDL would automatically convert any  
> negative arguments to positive.
> The last time I checked, the Webkit browsers do throw TypeError for  
> negative arguments (following DOM 2) and Firefox converts -1 to the  
> maximum positive unsigned long value (following the current version of  
> DOM4).

How does that follow the DOM? There's no such thing defined for  
deleteData() as far as I know.

> I'd like to suggest that the arguments to this (and similar) methods be  
> declared with [EnforceRange], which would bring DOM4 back into alignment  
> with the intent of DOM Level 2.  If someone passes -1 to deleteData(), I  
> think it is safe to say that they don't really mean 2^32-1.  An error is  
> the right thing here.

So we have to litter [EnforceRange] throughout a lot of methods? Is there  
an exhaustive list?

Anne van Kesteren
Received on Friday, 23 December 2011 15:01:31 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:36:59 UTC