W3C home > Mailing lists > Public > www-svg@w3.org > July 2009

Re: Canvas and Interactivity

From: Cameron McCormack <cam@mcc.id.au>
Date: Wed, 15 Jul 2009 18:55:37 +1000
To: Robert O'Callahan <robert@ocallahan.org>
Cc: Jeff Schiller <codedread@gmail.com>, anthony.grasso@cisra.canon.com.au, www-svg <www-svg@w3.org>
Message-ID: <20090715085537.GA12435@arc.mcc.id.au>
Robert O’Callahan:
> What does that mean for those of us who fear WebIDL?


A valueOf method on an object allows it to be converted into a primitive
when used with particular operators:

  >>> rect = { x: { valueOf: function() { return 12.5 } } }
  [object Object]
  >>> rect.x + 50

The internal [[DefaultValue]] method by default in ES232 calls valueOf
on the object.  So another way to achieve the same effect (the
SVGAnimatedLength object acting like a Number in some contexts) would be
to override that [[DefaultValue]].

It’s not perfect, though.  And it feels a bit too “clever”.  It also
wouldn’t work for SVGAnimatedBoolean objects, since the ECMAScript
ToBoolean() operator doesn’t invoke [[DefaultValue]] like ToNumber()

If we could get away with it, I agree that it would be better to just
replace the SVGAnimated* things with something simpler like what you

Cameron McCormack ≝ http://mcc.id.au/
Received on Wednesday, 15 July 2009 08:56:33 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:23 UTC