SVGTextContentElement.getSubStringLength() throwing on negative values


According to the latest SVG2 draft, SVGTextContentElement.getSubStringLength() should throw an IndexSizeError if charnum or nchars is negative:

Considering that an unsigned type is used for charnum and nchar, the value should be converted to a positive one as per the Web IDL specification (Step 4 in

Most other APIs that required to throw an IndexSizeError on negative values seem to have since been updated to stop doing so. See for example, CharacterData.deleteData(): (Before) (After)

I have also checked the behavior of existing browsers, Firefox 22, IE10 and Chrome 28 do NOT seem to throw if passed negative values that wrap to a valid positive index (Tested with

Considering the specification does not seem to match the behavior of major browsers, and considering that other specifications seem to have been updated to stop throwing in such cases, do you think it would make sense to update the wording in  the SVG2 specification to have getSubStringLength() throw an IndexSizeError only if charnum is greater than or equal to the number of characters at this node?

Christophe Dumez - Samsung Electronics

Received on Monday, 5 August 2013 10:14:23 UTC