SVGTextContentElement.getSubStringLength() throwing on negative values

Hi,

According to the latest SVG2 draft, SVGTextContentElement.getSubStringLength() should throw an IndexSizeError if charnum or nchars is negative:
https://svgwg.org/svg2-draft/text.html#__svg__SVGTextContentElement__getSubStringLength

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 http://dev.w3.org/2006/webapi/WebIDL/#es-unsigned-long).

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():
http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-7C603781 (Before)
http://www.w3.org/TR/2012/WD-dom-20121206/#concept-cd-replace (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 http://jsfiddle.net/hC7Cb/8/).

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?

Kr,
Christophe Dumez - Samsung Electronics

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