[fxtf-drafts] [geometry-1] Why does `multiplySelf` just accept another `DOMMatrix`? (#582)

trusktr has just created a new issue for https://github.com/w3c/fxtf-drafts:

== [geometry-1] Why does `multiplySelf` just accept another `DOMMatrix`? ==
I don't see why `multiplySelf` should accept a DOMMatrix-like object, rather than an actual DOMMatrix object.

If `multiplySelf` accepted `DOMMatrix` instances only (like an API of this sort would typically do, where "other" in a multiply(other) type of method is typically the same type of object as the object on which the method is called), then there would be no need to do runtime type checking of plain JS objects, which would improve performance.

By making it accept `DOMMatrix` instances, it would be possible to avoid the fixup steps, because the operations on DOMMatrix always produce valid properties (f.e. `a` is always the same value as `m11`).

instead of this:

```js
const a = {m11: 1, ..., m44: 1}

// later
const b = new DOMMatrix().multiplySelf(a)
```

we could have

```js
const a = new DOMMatrix([1, ..., 1])

// later
const b = new DOMMatrix().multiplySelf(a)
```

Is there a specific reason why we want to pass in non-DOMMatrix values?

Please view or discuss this issue at https://github.com/w3c/fxtf-drafts/issues/582 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 27 December 2024 09:13:49 UTC