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

On Tue, Oct 11, 2011 at 1:30 AM, Cameron McCormack <cam@mozilla.com> wrote:
> If that is the case, and we want to explicitly allow -1 to mean the end
> of the string, it might be better write that using a signed integer type
> and explicitly handling -1 in that way.

I agree, if we want that behavior.  For the second argument of
deleteData() and replaceData() (length), Gecko does seem to behave
this way, although WebKit throws.  But both Gecko and WebKit throw if
you pass -1 as the *first* argument (offset) of
deleteData()/insertData()/replaceData(), so I don't think changing
behavior there would be good.  We don't want to be inconsistent
either, so at least for deleteData()/insertData()/replaceData(),
always throwing for negative numbers looks like a better idea than not
throwing.

(I didn't test IE because I didn't want to bother starting my VM.
Opera consistently ignores the function call if provided a negative
number for these three methods, neither wrapping nor throwing.)

Received on Tuesday, 11 October 2011 14:15:51 UTC