Re: Proposal for SVG type constructors

On Mon, 09 Feb 2009 00:12:48 +0100, Cameron McCormack <cam@mcc.id.au> wrote:

>
> Erik Dahlström:
>> Adding a constructor that takes an Object and then calls some defined
>> functions on it might be another solution. Then perhaps we'd need just
>> that one constructor.
>
> Not sure what you mean by this.  Do you want to support:
>
>   var plainObject = { x: 123, y: 456 };
>   var point = new SVGPoint(plainObject);
>   plainObject.x = 124;
>   alert(point.x);  // alerts "124"
>
> ?  I.e., have the SVGPoint host object wrap the native object and use it
> as the storage for the point data?

Just thinking out loud. I didn't mean that the SVGPoint in your example would wrap (or be tied to) the native object, so in that example the alert would have shown 123. Though I guess it might be useful sometimes to be able to do what your example showed.

Cheers
/Erik

-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed

Received on Monday, 9 February 2009 09:57:26 UTC