This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
Note: This feature is available in Web Workers.
The DOMPointReadOnly interface specifies the coordinate and perspective fields used by DOMPoint to define a 2D or 3D point in a coordinate system.
There are two ways to create a new DOMPointReadOnly instance. First, you can use its constructor, passing in the values of the parameters for each dimension and, optionally, the perspective:
/* 2D */ const point2D = new DOMPointReadOnly(50, 50); /* 3D */ const point3D = new DOMPointReadOnly(50, 50, 25); /* 3D with perspective */ const point3DPerspective = new DOMPointReadOnly(100, 100, 100, 1.0);
The other option is to use the static DOMPointReadOnly.fromPoint() method:
const point = DOMPointReadOnly.fromPoint({ x: 100, y: 100, z: 50, w: 1.0 });
DOMPointReadOnly()Creates a new DOMPointReadOnly object given the values of its coordinates and perspective. To create a point using an object, you can instead use DOMPointReadOnly.fromPoint().
DOMPointReadOnly.x Read only
The point's horizontal coordinate, x.
DOMPointReadOnly.y Read only
The point's vertical coordinate, y.
DOMPointReadOnly.z Read only
The point's depth coordinate, z.
DOMPointReadOnly.w Read only
The point's perspective value, w.
DOMPointReadOnly.fromPoint()A static method that creates a new DOMPointReadOnly object given the coordinates provided in the specified object.
matrixTransform()Applies a matrix transform specified as an object to the DOMPointReadOnly object.
toJSON()Returns a JSON representation of the DOMPointReadOnly object.
| Specification |
|---|
| Geometry Interfaces Module Level 1> # DOMPoint> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
DOMPointReadOnly |
61 | 79 | 62 | 48 | 10.1 | 61 | 62 | 45 | 10.3 | 8.0 | 61 | 10.3 |
DOMPointReadOnly |
61 | 79 | 31 | 48 | 10.1 | 61 | 31 | 45 | 10.3 | 8.0 | 61 | 10.3 |
fromPoint_static |
61 | 79 | 62 | 48 | 10.1 | 61 | 62 | 45 | 10.3 | 8.0 | 61 | 10.3 |
matrixTransform |
61 | 79 | 69 | 48 | 11 | 61 | 79 | 45 | 11 | 8.0 | 61 | 11 |
toJSON |
61 | 79 | 62 | 48 | 10.1 | 61 | 62 | 45 | 10.3 | 8.0 | 61 | 10.3 |
w |
61 | 79 | 31 | 48 | 10.1 | 61 | 31 | 45 | 10.3 | 8.0 | 61 | 10.3 |
worker_support |
61 | 79 | 69 | 48 | 10.1 | 61 | 79 | 45 | 10.3 | 8.0 | 61 | 10.3 |
x |
61 | 79 | 31 | 48 | 10.1 | 61 | 31 | 45 | 10.3 | 8.0 | 61 | 10.3 |
y |
61 | 79 | 31 | 48 | 10.1 | 61 | 31 | 45 | 10.3 | 8.0 | 61 | 10.3 |
z |
61 | 79 | 31 | 48 | 10.1 | 61 | 31 | 45 | 10.3 | 8.0 | 61 | 10.3 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/DOMPointReadOnly