Skip to content
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
23 changes: 14 additions & 9 deletions files/en-us/mozilla/firefox/experimental_features/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -458,17 +458,22 @@ When this preference is enabled, any WebGL extensions currently in "draft" statu

#### WebGPU API

The [WebGPU API](/en-US/docs/Web/API/WebGPU_API) provides low-level support for performing computation and graphics rendering using the [Graphics Processing Unit](https://en.wikipedia.org/wiki/Graphics_Processing_Unit) (GPU) of the user's device or computer. See [Firefox bug 1602129](https://bugzil.la/1602129) for our progress on this API.

| Release channel | Version added | Enabled by default? |
| ----------------- | ------------- | ------------------- |
| Nightly | 113 | Yes |
| Developer Edition | 73 | No |
| Beta | 73 | No |
| Release | 73 | No |
The [WebGPU API](/en-US/docs/Web/API/WebGPU_API) provides low-level support for performing computation and graphics rendering using the [Graphics Processing Unit](https://en.wikipedia.org/wiki/Graphics_Processing_Unit) (GPU) of the user's device or computer.
From version 142 this is enabled in on Windows in all contexts except service workers.
For other platforms it is enabled in nightly.
See [Firefox bug 1602129](https://bugzil.la/1602129) for our progress on this API.

| Release channel | Version added | Enabled by default? |
| ----------------- | ------------- | -------------------------------------------------- |
| Nightly | 141 | Yes |
| Developer Edition | 141 | No (Yes on Windows, not including service workers) |
| Beta | 141 | No (Yes on Windows, not including service workers) |
| Release | 141 | No (Yes on Windows, not including service workers) |

- `dom.webgpu.enabled`
- : Set to `true` to enable.
- : Set to `true` to enable (enabled in Nightly and on Windows in all releases)
- `dom.webgpu.service-workers.enabled`
- : Set to `true` to enable (enabled in Nightly)

### Reporting API support for CSP Violations

Expand Down
1 change: 1 addition & 0 deletions files/en-us/mozilla/firefox/releases/141/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Firefox 141 is the current [Beta version of Firefox](https://www.firefox.com/en-
In the same way as the equivalent declarative attribute, [`popovertarget`](/en-US/docs/Web/HTML/Reference/Elements/button#popovertarget), this makes the popover more accessible to keyboard users (see [Popover accessibility features](/en-US/docs/Web/API/Popover_API/Using#popover_accessibility_features)). It also creates an implicit anchor reference between the two, which enables more natural positioning of popovers relative to their controls (see [Popover anchor positioning](/en-US/docs/Web/API/Popover_API/Using#popover_anchor_positioning)).
- The [`force`](/en-US/docs/Web/API/HTMLElement/togglePopover#force) or [`options.force`](/en-US/docs/Web/API/HTMLElement/togglePopover#force_2) arguments to `togglePopover()` can be used to force the popover open or closed, and is ignored if the popover is already in the forced state.
Unlike `showPopover()` and `hidePopover()`, this does not throw an exception if the popover is already in the target state.
- The [WebGPU API](/en-US/docs/Web/API/WebGPU_API) is now fully supported on Windows, in all contexts except for service workers. This allows developers to perform computation and graphics rendering using the [Graphics Processing Unit](https://en.wikipedia.org/wiki/Graphics_Processing_Unit) (GPU) of a user's computer. ([Firefox bug 1972486](https://bugzil.la/1972486)).

<!-- #### DOM -->

Expand Down
65 changes: 65 additions & 0 deletions files/en-us/web/api/caretposition/getclientrect/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: "CaretPosition: getClientRect() method"
short-title: getClientRect()
slug: Web/API/CaretPosition/getClientRect
page-type: web-api-instance-method
browser-compat: api.CaretPosition.getClientRect
---

The `getClientRect()` method of the {{domxref("CaretPosition")}} interface returns the client rectangle for the caret range.

## Syntax

```js-nolint
getClientRect()
```

### Parameters

None.

### Return value

A {{domxref("DOMRect")}} object.

## Examples

### Get the caret's screen position

```html
<input
aria-label="text field"
value="Click inside this input field"
style="width: 100%; padding: 10px; font-size: 16px; box-sizing: border-box" />
```

```js
document.querySelector("input").addEventListener("click", (event) => {
const x = event.clientX;
const y = event.clientY;

const caret = document.caretPositionFromPoint?.(x, y);
if (!caret) return;

const rect = caret.getClientRect();

console.dir("Caret bounding rect:", rect);
console.log(`Caret is at (${rect.x.toFixed(2)}, ${rect.y.toFixed(2)})`);
});
```

{{EmbedLiveSample("get_client_rect", "", 300)}}

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("DOMRect")}}
- {{domxref("Document.caretPositionFromPoint()")}}
- {{domxref("Element.getBoundingClientRect()")}}
57 changes: 57 additions & 0 deletions files/en-us/web/api/caretposition/offset/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: "CaretPosition: offset property"
short-title: offset
slug: Web/API/CaretPosition/offset
page-type: web-api-instance-property
browser-compat: api.CaretPosition.offset
---

The **`offset`** property of the {{domxref("CaretPosition")}} interface returns an integer representing the offset of the selection in the caret position node.

This will be the character offset in a text node or the selected child node's index in an element node.

## Value

An integer.

## Examples

This example logs the `offsetNode` and `offset` of the caret position when clicking inside the input field

```html
<input
aria-label="text field"
value="Click inside this input field"
style="width: 100%; padding: 10px; font-size: 16px; box-sizing: border-box" />
```

```js
document.querySelector("input").addEventListener("click", (event) => {
const x = event.clientX;
const y = event.clientY;

const caret = document.caretPositionFromPoint?.(x, y);
if (!caret) return;

const node = caret.offsetNode;
const offset = caret.offset;

console.log("offsetNode:", node);
console.log("offset:", offset);
});
```

{{EmbedLiveSample("offset", "", 300)}}

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("Node")}}
- {{domxref("Document.caretPositionFromPoint()")}}
55 changes: 55 additions & 0 deletions files/en-us/web/api/caretposition/offsetnode/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
title: "CaretPosition: offsetNode property"
short-title: offsetNode
slug: Web/API/CaretPosition/offsetNode
page-type: web-api-instance-property
browser-compat: api.CaretPosition.offsetNode
---

The **`offsetNode`** property of the {{domxref("CaretPosition")}} interface returns a {{domxref("Node")}} containing the found node at the caret's position.

## Value

A {{domxref("Node")}}.

## Examples

This example logs the `offsetNode` and `offset` of the caret position when clicking inside the input field

```html
<input
aria-label="text field"
value="Click inside this input field"
style="width: 100%; padding: 10px; font-size: 16px; box-sizing: border-box" />
```

```js
document.querySelector("input").addEventListener("click", (event) => {
const x = event.clientX;
const y = event.clientY;

const caret = document.caretPositionFromPoint?.(x, y);
if (!caret) return;

const node = caret.offsetNode;
const offset = caret.offset;

console.log("offsetNode:", node);
console.log("offset:", offset);
});
```

{{EmbedLiveSample("offsetnode", "", 300)}}

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("Node")}}
- {{domxref("Document.caretPositionFromPoint()")}}