Re: [geometry] Cloning DOMPoint, DOMMatrix and DOMRect instances

On Fri, 27 Dec 2013 21:01:36 +0100, Jarek Foksa <jarek@foksa.name> wrote:

> What will be the preferred way to clone an instance of DOMPoint,  
> DOMMatrix and DOMRect? Will it be possible to pass an instance to a  
> constructor in order to create a clone? For example:
>
>   let initialPosition = new Point(100, 100);
>   let currentPosition = new Point(initialPosition);

Yes.

> Even if this will be possible, I think it would more convenient to have  
> a clone() method on geometry interfaces just like there is cloneNode()  
> on DOM Node interface:
>
>   let initialPosition = new Point(100, 100);
>   let currentPosition = initialPosition.clone();

It's 3 characters shorter to type but it adds one more method of API  
surface and gives no new abilities, so I think it should not be added.

-- 
Simon Pieters
Opera Software

Received on Wednesday, 15 January 2014 14:09:59 UTC