Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. DOMPointReadOnly
  4. toJSON()

DOMPointReadOnly: toJSON() method

Baseline Widely available

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 inWeb Workers.

TheDOMPointReadOnly methodtoJSON() returns an object giving theJSON form of the point object.

Syntax

js
toJSON()

Parameters

None.

Return value

A new object whose properties are set to the values in theDOMPoint orDOMPointReadOnly on which the method was called.

Examples

This example creates aDOMPoint object representing the top-left cornerof the current window, in screen coordinates, then converts that to JSON.

js
const topLeft = new DOMPoint(window.screenX, window.screenY);const pointJSON = topLeft.toJSON();

Specifications

Specification
Geometry Interfaces Module Level 1
# dom-dompointreadonly-tojson

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp