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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ npm -v
After you have installed Node.js, you can install the dependencies using `npm install` and start the local preview:

```bash
npm
npm i
npm start
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ For numeric fields, including [`<input type="number">`](/en-US/docs/Web/HTML/Ref
If the field contains a value outside this range, it will be invalid.

Let's look at another example.
Create a new copy of the [basic starter file](#basic_starter_file) file (save it in the same directory as `index2.html`).
Create a new copy of the [basic starter file](#basic_starter_file) and save it in the same directory as `index2.html`.

Now delete the contents of the `<body>` element, and replace it with the following:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Example:
- `isCustomObject` {{ReadOnlyInline}}
- : Indicates, if `true`, that the object is a custom one.
- `parameterX` {{optional_inline}}
- : Blah blah blah
- : Indicates

## Status and compatibility indicators

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ Values of this type are objects. They contain these properties:
- `queryTransform` {{optional_inline}}
- : An object describing how to add, remove, or replace query key-value pairs. Cannot be specified if 'query' is specified.
- `addOrReplaceParams` {{optional_inline}}
- : An array of objects describing the list of query key-value pairs to be added or replaced.
- : An array of objects describing the list of query key-value pairs (`key=value`) to be added or replaced.
- `key`
- : A `string`. The key value.
- : A `string`. The `key` part of `key=value`.
- `replaceOnly` {{optional_inline}}
- : A `boolean`. If true, the query key is replaced only if it's already present. Otherwise, the key is also added if it's missing. Defaults to false.
- : A `boolean`. If true, the query key is replaced only if it's already present. Otherwise, the key is also added if it's missing. Defaults to `false`.
- `value`
- : A `string`. The value value.
- : A `string`. The `value` part of `key=value`.

- `removeParams` {{optional_inline}}
- : An array of `string`. The list of query keys to be removed.
Expand Down
2 changes: 2 additions & 0 deletions files/en-us/web/api/htmlanchorelement/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ _Inherits properties from its parent, {{domxref("HTMLElement")}}._
- : A string that is the result of parsing the [`href`](/en-US/docs/Web/HTML/Reference/Elements/a#href) HTML attribute relative to the document, containing a valid URL of a linked resource.
- {{domxref("HTMLAnchorElement.hreflang")}}
- : A string that reflects the [`hreflang`](/en-US/docs/Web/HTML/Reference/Elements/a#hreflang) HTML attribute, indicating the language of the linked resource.
- {{domxref("HTMLAnchorElement.interestForElement")}} {{experimental_inline}}
- : Gets or sets the target element of an interest invoker, in cases where the associated {{htmlelement("a")}} element is specified as an [interest invoker](/en-US/docs/Web/API/Popover_API/Using_interest_invokers#creating_an_interest_invoker).
- {{domxref("HTMLAnchorElement.origin")}} {{ReadOnlyInline}}
- : Returns a string containing the origin of the URL, that is its scheme, its domain and its port.
- {{domxref("HTMLAnchorElement.password")}}
Expand Down
66 changes: 66 additions & 0 deletions files/en-us/web/api/htmlanchorelement/interestforelement/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: "HTMLAnchorElement: interestForElement property"
short-title: interestForElement
slug: Web/API/HTMLAnchorElement/interestForElement
page-type: web-api-instance-property
browser-compat: api.HTMLAnchorElement.interestForElement
---

{{ApiRef("HTML DOM")}}

The **`interestForElement`** property of the {{domxref("HTMLAnchorElement")}} interface gets or sets the target element of an interest invoker, in cases where the associated {{htmlelement("a")}} element is specified as an interest invoker.

See [Creating an interest invoker](/en-US/docs/Web/API/Popover_API/Using_interest_invokers#creating_an_interest_invoker) for more details.

## Value

An {{domxref("Element")}} object instance, or `null` if the associated `<a>` element does not have a target element set.

## Examples

### Basic `interestForElement` usage

In this example, we use an `<a>` element's `interestForElement` property to set its target element and then retrieve that element's `tagName`. The `tagName` is then printed in the `<a>` element's text content.

#### HTML

The markup includes an `<a>` element and a `<div>` element. We turn the `<div>` element into a popover by setting a `popover` attribute on it.

```html live-sample___basic-interest-invoker
<a href="#">a link</a>
<div id="mypopover" popover>I am a <code>&lt;div&gt;</code> element.</div>
```

#### JavaScript

We get references to the `<a>` and `<div>` elements in script. We then create the interest invoker-target relationship between the `<a>` and the `<div>` by setting the `<a>` element's `interestForElement` property equal to a reference to the `<div>`. We then update the `<a>` element's text content to include a string containing the target element's `tagName`, retrieved via `invoker.interestForElement.tagName`.

```js live-sample___basic-interest-invoker
const invoker = document.querySelector("a");
const popover = document.querySelector("div");

invoker.interestForElement = popover;

invoker.textContent = `My target is a ${invoker.interestForElement.tagName} element`;
```

#### Result

The example renders like this:

{{embedlivesample("basic-interest-invoker", "100%", "100")}}

Try showing interest in the link (for example, by hovering or focusing it) to make the `<div>` appear.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- [Using interest invokers](/en-US/docs/Web/API/Popover_API/Using_interest_invokers)
- [The Popover API](/en-US/docs/Web/API/Popover_API)
2 changes: 2 additions & 0 deletions files/en-us/web/api/htmlareaelement/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ _Inherits properties from its parent {{domxref("HTMLElement")}}._
- : A string containing the hostname in the referenced URL.
- {{domxref("HTMLAreaElement.href")}}
- : A string containing that reflects the [`href`](/en-US/docs/Web/HTML/Reference/Elements/area#href) HTML attribute, containing a valid URL of a linked resource.
- {{domxref("HTMLAreaElement.interestForElement")}} {{experimental_inline}}
- : Gets or sets the target element of an interest invoker, in cases where the associated {{htmlelement("area")}} element is specified as an [interest invoker](/en-US/docs/Web/API/Popover_API/Using_interest_invokers#creating_an_interest_invoker).
- {{domxref("HTMLAreaElement.noHref")}} {{deprecated_inline}}
- : A boolean flag indicating if the area is inactive (`true`) or active (`false`).
- {{domxref("HTMLAreaElement.origin")}} {{ReadOnlyInline}}
Expand Down
77 changes: 77 additions & 0 deletions files/en-us/web/api/htmlareaelement/interestforelement/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
title: "HTMLAreaElement: interestForElement property"
short-title: interestForElement
slug: Web/API/HTMLAreaElement/interestForElement
page-type: web-api-instance-property
browser-compat: api.HTMLAreaElement.interestForElement
---

{{ApiRef("HTML DOM")}}

The **`interestForElement`** property of the {{domxref("HTMLAreaElement")}} interface gets or sets the target element of an interest invoker, in cases where the associated {{htmlelement("area")}} element is specified as an interest invoker.

See [Creating an interest invoker](/en-US/docs/Web/API/Popover_API/Using_interest_invokers#creating_an_interest_invoker) for more details.

## Value

An {{domxref("Element")}} object instance, or `null` if the associated `<area>` element does not have a target element set.

## Examples

### Basic `interestForElement` usage

In this example, we use an `<area>` element's `interestForElement` property to set its target element and then retrieve the target element's `tagName`. The `tagName` is then printed in the `<area>` element's text content.

#### HTML

We include an `<area>` element and a `<div>` element. We turn the `<div>` element into a popover by setting a `popover` attribute on it.

```html live-sample___basic-interest-invoker
<map>
<area href="#" shape="default" />
</map>
<div id="mypopover" popover>I am a <code>&lt;div&gt;</code> element.</div>
```

```css hidden live-sample___basic-interest-invoker
map {
width: 200px;
height: 100px;
background-color: pink;
padding: 5px;
}
```

#### JavaScript

We get references to the `<area>` and `<div>` elements in script, then declare an interest invoker-target relationship between the `<area>` and the `<div>` by setting the `<area>` element's `interestForElement` property equal to a reference to the `<div>`. We then set the `<area>` element's text content equal to a string containing the target element's `tagName`, retrieved via `invoker.interestForElement.tagName`.

```js live-sample___basic-interest-invoker
const invoker = document.querySelector("area");
const popover = document.querySelector("div");

invoker.interestForElement = popover;

invoker.textContent = `My target is a ${invoker.interestForElement.tagName} element`;
```

#### Result

The example renders like this:

{{embedlivesample("basic-interest-invoker", "100%", "100")}}

Try showing interest in the area (for example, by hovering or focusing it) to make the `<div>` appear.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- [Using interest invokers](/en-US/docs/Web/API/Popover_API/Using_interest_invokers)
- [The Popover API](/en-US/docs/Web/API/Popover_API)
2 changes: 2 additions & 0 deletions files/en-us/web/api/htmlbuttonelement/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ _Inherits properties from its parent, {{domxref("HTMLElement")}}._
- : A boolean value indicating that the form is not to be validated when it is submitted. If specified, this attribute overrides the [`novalidate`](/en-US/docs/Web/HTML/Reference/Elements/form#novalidate) attribute of the {{HTMLElement("form")}} element that owns this element.
- {{domxref("HTMLButtonElement.formTarget")}}
- : A string reflecting a name or keyword indicating where to display the response received after submitting the form. If specified, this attribute overrides the [`target`](/en-US/docs/Web/HTML/Reference/Elements/form#target) attribute of the {{HTMLElement("form")}} element that owns this element.
- {{domxref("HTMLButtonElement.interestForElement")}} {{experimental_inline}}
- : Gets or sets the target element of an interest invoker, in cases where the associated {{htmlelement("button")}} element is specified as an [interest invoker](/en-US/docs/Web/API/Popover_API/Using_interest_invokers#creating_an_interest_invoker).
- {{domxref("HTMLButtonElement.labels")}} {{ReadOnlyInline}}
- : A {{domxref("NodeList")}} that represents a list of {{HTMLElement("label")}} elements that are labels for this button.
- {{domxref("HTMLButtonElement.name")}}
Expand Down
66 changes: 66 additions & 0 deletions files/en-us/web/api/htmlbuttonelement/interestforelement/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: "HTMLButtonElement: interestForElement property"
short-title: interestForElement
slug: Web/API/HTMLButtonElement/interestForElement
page-type: web-api-instance-property
browser-compat: api.HTMLButtonElement.interestForElement
---

{{ApiRef("HTML DOM")}}

The **`interestForElement`** property of the {{domxref("HTMLButtonElement")}} interface gets or sets the target element of an interest invoker, in cases where the associated {{htmlelement("button")}} element is specified as an interest invoker.

See [Creating an interest invoker](/en-US/docs/Web/API/Popover_API/Using_interest_invokers#creating_an_interest_invoker) for more details.

## Value

An {{domxref("Element")}} object instance, or `null` if the associated `<button>` element does not have a target element set.

## Examples

### Basic `interestForElement` usage

In this example, we use a `<button>` element's `interestForElement` property to set its target element and then retrieve the target element's `tagName`. The `tagName` is then printed in the `<button>` element's text content.

#### HTML

We include a `<button>` element and a `<div>` element. We turn the `<div>` element into a popover by setting a `popover` attribute on it.

```html live-sample___basic-interest-invoker
<button href="#">a button</button>
<div id="mypopover" popover>I am a <code>&lt;div&gt;</code> element.</div>
```

#### JavaScript

We get references to the `<button>` and `<div>` elements in script, then declare an interest invoker-target relationship between the `<button>` and the `<div>` by setting the `<button>` element's `interestForElement` property equal to a reference to the `<div>`. We then set the button's text content equal to a string containing the target element's `tagName`, retrieved via `invoker.interestForElement.tagName`.

```js live-sample___basic-interest-invoker
const invoker = document.querySelector("button");
const popover = document.querySelector("div");

invoker.interestForElement = popover;

invoker.textContent = `My target is a ${invoker.interestForElement.tagName} element`;
```

#### Result

The example renders like this:

{{embedlivesample("basic-interest-invoker", "100%", "100")}}

Try showing interest in the button (for example, by hovering or focusing it) to make the `<div>` appear.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- [Using interest invokers](/en-US/docs/Web/API/Popover_API/Using_interest_invokers)
- [The Popover API](/en-US/docs/Web/API/Popover_API)
7 changes: 7 additions & 0 deletions files/en-us/web/api/htmlelement/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ _Also, inherits events from its parent, {{DOMxRef("Element")}}._
- {{DOMxRef("HTMLElement/drop_event", "drop")}}
- : This event is fired when an element or text selection is dropped on a valid drop target.

### Interest invoker events

- {{domxref("HTMLElement.interest_event", "interest")}} {{experimental_inline}}
- : Fired on the target element of an [interest invoker](/en-US/docs/Web/API/Popover_API/Using_interest_invokers) when interest is shown, allowing code to be run in response.
- {{domxref("HTMLElement.loseinterest_event", "loseinterest")}} {{experimental_inline}}
- : Fired on the target element of an interest invoker when interest is lost, allowing code to be run in response.

### Toggle events

- {{DOMxRef("HTMLElement/beforetoggle_event", "beforetoggle")}}
Expand Down
87 changes: 87 additions & 0 deletions files/en-us/web/api/htmlelement/interest_event/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
title: "HTMLElement: interest event"
slug: Web/API/HTMLElement/interest_event
page-type: web-api-event
browser-compat: api.HTMLElement.interest_event
---

{{APIRef("HTML DOM")}}

The **`interest`** event of the {{domxref("HTMLElement")}} interface is fired on an [interest invoker](/en-US/docs/Web/API/Popover_API/Using_interest_invokers)'s target element when interest is shown, allowing code to be run in response.

## Syntax

Use the event name in methods like {{domxref("EventTarget.addEventListener", "addEventListener()")}}, or set an event handler property.

```js-nolint
addEventListener("interest", (event) => { })

oninterest = (event) => { }
```

## Event type

An {{domxref("InterestEvent")}}. Inherits from {{domxref("Event")}}.

{{InheritanceDiagram("InterestEvent")}}

## Examples

### Basic interest invoker event usage

In this example, we use the `interest` and `loseinterest` events to report when interest is shown and lost on a {{htmlelement("button")}} element that acts as an interest invoker. We do this by printing messages into the target {{htmlelement("p")}} element's text content.

#### HTML

We set up the relationship between the `<button>` element interest invoker and its target `<p>` element by setting the value of the `<button>` element's `interestfor` attribute equal to the `<p>` element's `id`.

```html live-sample___basic-interest-invoker
<button href="#" interestfor="mytarget">Interest invoker</button>
<p id="mytarget">No interest being shown currently.</p>
```

#### JavaScript

We get a reference to the `<button>` element and its target element via the {{domxref("HTMLButtonElement.interestForElement", "interestForElement")}} property.

```js live-sample___basic-interest-invoker
const invoker = document.querySelector("[interestfor]");
const target = invoker.interestForElement;
```

We then set two event listeners on the target element, for the `interest` and `loseinterest` events.

- When interest is shown, we update the target `<p>` element's text content to report the event and include the element that triggered it; in this example, that's the `<button>` element. Note how you can get a reference to the interest invoker via the event object's {{domxref("InterestEvent.source", "source")}} property.
- When interest is lost, we update the paragraph text to report that interest is no longer being shown.

```js live-sample___basic-interest-invoker
target.addEventListener("interest", (e) => {
target.textContent = `Interest shown via the ${e.source.tagName} element.`;
});

target.addEventListener("loseinterest", () => {
target.textContent = `Interest lost.`;
});
```

#### Result

The example renders like this:

{{embedlivesample("basic-interest-invoker", "100%", "100")}}

Try showing and losing interest in the button (for example, by hovering or focusing it) to see how the `<p>` text changes.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- {{domxref("HTMLElement.loseinterest_event", "loseinterest")}} event
- [Popover API](/en-US/docs/Web/API/Popover_API)
- [Using interest invokers](/en-US/docs/Web/API/Popover_API/Using_interest_invokers)
Loading