- From: Dean Jackson <dino@apple.com>
- Date: Sat, 27 Aug 2011 11:36:13 +1000
- To: Øyvind Stenhaug <oyvinds@opera.com>
- Cc: www-svg@w3.org
On 24/08/2011, at 10:49 PM, Øyvind Stenhaug wrote:
> Units
>
> This doesn't seem to consider what happens if the unitType argument is a zero length, e.g. SVG_LENGTHTYPE_EMS when 1em=0px.
>
> <svg xmlns="http://www.w3.org/2000/svg" font-size="0">
> <rect width="100px"/>
> <script type="application/ecmascript">
> onload = function() {
> try {
> var width = document.querySelector('rect').width.baseVal;
> width.convertToSpecifiedUnits(width.SVG_LENGTHTYPE_EMS);
> alert(width.valueInSpecifiedUnits + ' ' + width.value);
> } catch(e) {
> alert(e);
> }
> }
> </script>
> </svg>
>
> Gecko and Presto give "Infinity NaN", failing to "[p]reserve the same underlying stored value".
>
> WebKit throws NOT_SUPPORTED_ERR, although the spec only says it's "[r]aised if unitType is SVG_LENGTHTYPE_UNKNOWN or not a valid unit type constant (one of the other SVG_LENGTHTYPE_* constants defined on this interface)".
>
> (When trying to convert a zero value, Presto gives "0 0", Gecko "NaN NaN" and WebKit still throws.)
The WebKit behaviour here is a bug which is easily fixed, but what values do you suggest we return?
Dean
Received on Saturday, 27 August 2011 01:40:36 UTC