Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOMRect instance properties #36704

Merged
merged 13 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions files/en-us/web/api/domrect/domrect/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ new DOMRect(x, y, width, height)

### Parameters

- `x`
- {{domxref("DOMRect.x", "x")}}
- : The `x` coordinate of the `DOMRect`'s origin.
- `y`
- {{domxref("DOMRect.y", "y")}}
- : The `y` coordinate of the `DOMRect`'s origin.
- `width`
- {{domxref("DOMRect.width", "width")}}
- : The width of the `DOMRect`.
- `height`
- {{domxref("DOMRect.height", "height")}}
- : The height of the `DOMRect`.

### Return value
Expand Down
27 changes: 27 additions & 0 deletions files/en-us/web/api/domrect/height/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: "DOMRect: height property"
short-title: height
slug: Web/API/DOMRect/height
page-type: web-api-instance-property
browser-compat: api.DOMRect.height
---

{{APIRef("Geometry Interfaces")}}{{AvailableInWorkers}}

The **`height`** property of the {{domxref("DOMRect")}} interface represents the height of the rectangle. The value can be negative.

## Value

A double.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("DOMRectReadOnly")}}
8 changes: 4 additions & 4 deletions files/en-us/web/api/domrect/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ It inherits from its parent, {{domxref("DOMRectReadOnly")}}.

_`DOMRect` inherits properties from its parent, {{domxref("DOMRectReadOnly")}}. The difference is that they are not read-only anymore._

- {{domxref("DOMRectReadOnly.x")}}
- {{domxref("DOMRect.x")}}
- : The x coordinate of the `DOMRect`'s origin (typically the top-left corner of the rectangle).
- {{domxref("DOMRectReadOnly.y")}}
- {{domxref("DOMRect.y")}}
- : The y coordinate of the `DOMRect`'s origin (typically the top-left corner of the rectangle).
- {{domxref("DOMRectReadOnly.width")}}
- {{domxref("DOMRect.width")}}
- : The width of the `DOMRect`.
- {{domxref("DOMRectReadOnly.height")}}
- {{domxref("DOMRect.height")}}
- : The height of the `DOMRect`.
- {{domxref("DOMRectReadOnly.top")}}
- : Returns the top coordinate value of the `DOMRect` (has the same value as `y`, or `y + height` if `height` is negative).
Expand Down
27 changes: 27 additions & 0 deletions files/en-us/web/api/domrect/width/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: "DOMRect: width property"
short-title: width
slug: Web/API/DOMRect/width
page-type: web-api-instance-property
browser-compat: api.DOMRect.width
---

{{APIRef("Geometry Interfaces")}}{{AvailableInWorkers}}

The **`width`** property of the {{domxref("DOMRect")}} interface represents the width of the rectangle. The value can be negative.

## Value

A double.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("DOMRectReadOnly")}}
29 changes: 29 additions & 0 deletions files/en-us/web/api/domrect/x/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: "DOMRect: x property"
short-title: x
slug: Web/API/DOMRect/x
page-type: web-api-instance-property
browser-compat: api.DOMRect.x
---

{{APIRef("Geometry Interfaces")}}{{AvailableInWorkers}}

The **`x`** property of the {{domxref("DOMRect")}} interface represents the x-coordinate of the rectangle, which is the horizontal distance between the viewport's left edge and the rectangle's origin.

When the rectangle's width is non-negative, the rectangle's horizontal origin is the viewport's left edge. If the width is negative, the rectangle's horizontal origin is the viewport's right edge.

## Value

A double.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("DOMRectReadOnly")}}
29 changes: 29 additions & 0 deletions files/en-us/web/api/domrect/y/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: "DOMRect: y property"
short-title: "y"
slug: Web/API/DOMRect/y
page-type: web-api-instance-property
browser-compat: api.DOMRect.y
---

{{APIRef("Geometry Interfaces")}}{{AvailableInWorkers}}

The **`y`** property of the {{domxref("DOMRect")}} interface represents the y-coordinate of the rectangle, which is the vertical distance between the viewport's top edge and the rectangle's origin.

When the rectangle's height is non-negative, the rectangle's vertical origin is the viewport's top edge. If the height has a negative height, the rectangle's vertical origin is the viewport's bottom edge.

## Value

A double.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("DOMRectReadOnly")}}