-
Notifications
You must be signed in to change notification settings - Fork 23.1k
Editorial review: Document interest invokers #42021
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
Merged
Merged
Changes from all commits
Commits
Show all changes
188 commits
Select commit
Hold shift + click to select a range
d49943b
Document interest invokers
chrisdavidmills 8acc235
Add interestfor attribute to element reference pages
chrisdavidmills 307a9f9
Document interestForElement property
chrisdavidmills e2b424e
Remove interface prefixes from events
chrisdavidmills 20cdaef
Add interest and loseinterest events
chrisdavidmills 4b88315
Add InterestEvent reference docs
chrisdavidmills c6ceb25
Add interest-delay ref pages
chrisdavidmills 4d4aafd
Add pseudo-classes
chrisdavidmills f5ec776
Merge branch 'main' into interest-invokers
chrisdavidmills 743bc14
fixes for mfreed7 review comments
chrisdavidmills 002d7a5
Add working :has() example
chrisdavidmills 18e86f5
Update files/en-us/web/api/popover_api/interest_invokers/index.md
chrisdavidmills ba0c27f
Update files/en-us/web/api/popover_api/interest_invokers/index.md
chrisdavidmills 95ee0af
Update files/en-us/web/api/popover_api/interest_invokers/index.md
chrisdavidmills 14bb78a
Update files/en-us/web/api/popover_api/interest_invokers/index.md
chrisdavidmills c02e2da
Update files/en-us/web/api/popover_api/interest_invokers/index.md
chrisdavidmills 2b68d91
Update files/en-us/web/api/popover_api/interest_invokers/index.md
chrisdavidmills d354692
Update files/en-us/web/api/popover_api/interest_invokers/index.md
chrisdavidmills b844a71
Update files/en-us/web/api/popover_api/interest_invokers/index.md
chrisdavidmills c898f5e
Update files/en-us/web/api/popover_api/interest_invokers/index.md
chrisdavidmills 09296b3
Update files/en-us/web/api/popover_api/interest_invokers/index.md
chrisdavidmills 9246f6d
Update files/en-us/web/api/popover_api/interest_invokers/index.md
chrisdavidmills f755044
Update files/en-us/web/api/popover_api/interest_invokers/index.md
chrisdavidmills c1294b4
Update files/en-us/web/api/popover_api/interest_invokers/index.md
chrisdavidmills b3fd5a2
Update files/en-us/web/api/popover_api/interest_invokers/index.md
chrisdavidmills 1814ad6
Update files/en-us/web/api/popover_api/interest_invokers/index.md
chrisdavidmills 66caa0a
Update files/en-us/web/api/popover_api/interest_invokers/index.md
chrisdavidmills 3a66210
Update files/en-us/web/api/popover_api/interest_invokers/index.md
chrisdavidmills 4fbc74a
Update files/en-us/web/api/popover_api/interest_invokers/index.md
chrisdavidmills 0382a5f
Merge branch 'main' into interest-invokers
chrisdavidmills 317b4e9
Change guide URL
chrisdavidmills 5976782
Fixes for dipika review comments
chrisdavidmills 9a7b830
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills c5a702d
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills f90becb
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills ca8d15c
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 6399a16
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 87af3e9
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 13586ed
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills ba4a5ec
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills a46581b
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills b5b1bfc
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 00420e9
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 007eda3
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 9f93c49
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 8ba9e44
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 89245b9
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills cf0eaeb
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 513a9bb
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills d395402
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 14f7628
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills c079e95
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 8c7e7a9
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills e43cd22
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 4f9ce91
Replace CSS links with macros
chrisdavidmills 77abdec
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills e35f4ca
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 655ca8f
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 1452d34
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 880b0b9
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 318aa7b
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 7e27c64
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 20a2e93
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 18ca014
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 64b76b4
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 5a15c59
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills d0ad34c
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 9f9b191
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 48b0d11
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 4e8f531
Merge branch 'main' into interest-invokers
caugner 4d35e12
Add links to interest invoker examples landing page
chrisdavidmills d4e5bc7
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills e769044
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 3925802
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 5a83210
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills e89a360
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 221a17f
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 4d99b0f
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills b6c3693
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills c164332
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 8df6ccd
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills dcdea93
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills a175873
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 3893614
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 8eee88a
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 533eec7
Update files/en-us/web/css/reference/properties/interest-delay/index.md
chrisdavidmills 8b83526
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 7ae2751
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 63ff21f
Update files/en-us/web/api/popover_api/index.md
chrisdavidmills 6b5a69d
Update files/en-us/web/api/popover_api/index.md
chrisdavidmills 2da1b4b
Update files/en-us/web/api/popover_api/index.md
chrisdavidmills 37c8d9f
Update files/en-us/web/api/popover_api/index.md
chrisdavidmills 7fda6e2
Update files/en-us/web/api/popover_api/index.md
chrisdavidmills d74997a
Update files/en-us/web/api/popover_api/using/index.md
chrisdavidmills b8080ab
Update files/en-us/web/css/reference/properties/interest-delay/index.md
chrisdavidmills 919953a
Update files/en-us/web/css/reference/properties/interest-delay/index.md
chrisdavidmills 8002ffb
Update files/en-us/web/css/reference/properties/interest-delay/index.md
chrisdavidmills a1dced1
Update files/en-us/web/css/reference/properties/interest-delay/index.md
chrisdavidmills 1b1d8b8
Update files/en-us/web/css/reference/properties/interest-delay/index.md
chrisdavidmills e0e414a
Update files/en-us/web/css/reference/properties/interest-delay/index.md
chrisdavidmills c9e0fe3
Update files/en-us/web/html/reference/elements/a/index.md
chrisdavidmills 1ad58c4
Update files/en-us/web/html/reference/elements/area/index.md
chrisdavidmills 4d398ae
Update files/en-us/web/css/reference/properties/interest-delay/index.md
chrisdavidmills 1cf1664
Update files/en-us/web/css/reference/properties/interest-delay/index.md
chrisdavidmills 9433726
Update files/en-us/web/api/popover_api/using_interest_invokers/index.md
chrisdavidmills 1420822
Update files/en-us/web/css/reference/properties/interest-delay/index.md
chrisdavidmills b924c4c
Update files/en-us/web/css/reference/properties/interest-delay/index.md
chrisdavidmills 9544a2e
Update files/en-us/web/html/reference/elements/button/index.md
chrisdavidmills 3449159
Update files/en-us/web/svg/reference/element/a/index.md
chrisdavidmills 2d7789c
Update files/en-us/web/css/reference/selectors/_colon_interest-source…
chrisdavidmills fd517a1
Update files/en-us/web/css/reference/selectors/_colon_interest-source…
chrisdavidmills ba106e4
Update files/en-us/web/css/reference/selectors/_colon_interest-source…
chrisdavidmills f7b3b67
Update files/en-us/web/css/reference/selectors/_colon_interest-source…
chrisdavidmills a59ae36
Update files/en-us/web/css/reference/selectors/_colon_interest-source…
chrisdavidmills 511bf9f
Update files/en-us/web/css/reference/selectors/_colon_interest-source…
chrisdavidmills b73069d
Update files/en-us/web/css/reference/selectors/_colon_interest-source…
chrisdavidmills 10d9ba2
Update files/en-us/web/css/reference/selectors/_colon_interest-target…
chrisdavidmills 33ea5dd
Update files/en-us/web/css/reference/selectors/_colon_interest-target…
chrisdavidmills 601a989
Update files/en-us/web/css/reference/selectors/_colon_interest-target…
chrisdavidmills 4428dd5
Update files/en-us/web/css/reference/selectors/_colon_interest-target…
chrisdavidmills 200504a
Update files/en-us/web/css/reference/selectors/_colon_interest-source…
chrisdavidmills 6e7a3d5
Update files/en-us/web/css/reference/selectors/_colon_interest-target…
chrisdavidmills 6f2c5af
Update files/en-us/web/css/reference/selectors/_colon_interest-target…
chrisdavidmills bff3611
Update files/en-us/web/css/reference/selectors/_colon_interest-target…
chrisdavidmills 424b389
Update files/en-us/web/api/htmlanchorelement/interestforelement/index.md
chrisdavidmills 541cd7d
Update files/en-us/web/api/htmlanchorelement/interestforelement/index.md
chrisdavidmills 9f2a084
Update files/en-us/web/api/htmlanchorelement/interestforelement/index.md
chrisdavidmills aa3a4ce
Update files/en-us/web/api/htmlanchorelement/interestforelement/index.md
chrisdavidmills 3c8b5fd
Update files/en-us/web/api/htmlanchorelement/interestforelement/index.md
chrisdavidmills 38908e0
Update files/en-us/web/api/htmlanchorelement/index.md
chrisdavidmills e8ba0e1
Update files/en-us/web/api/htmlareaelement/interestforelement/index.md
chrisdavidmills e0547f9
Update files/en-us/web/api/interestevent/interestevent/index.md
chrisdavidmills a294766
Update files/en-us/web/api/htmlbuttonelement/interestforelement/index.md
chrisdavidmills 772d84b
Update files/en-us/web/api/htmlareaelement/interestforelement/index.md
chrisdavidmills 763016c
Update files/en-us/web/api/interestevent/interestevent/index.md
chrisdavidmills 0bcd95b
Update files/en-us/web/api/interestevent/source/index.md
chrisdavidmills 7615e85
Update files/en-us/web/api/htmlbuttonelement/interestforelement/index.md
chrisdavidmills 2288aad
Update files/en-us/web/api/htmlareaelement/interestforelement/index.md
chrisdavidmills 459be29
Update files/en-us/web/api/htmlbuttonelement/interestforelement/index.md
chrisdavidmills 570eaad
Update files/en-us/web/api/htmlareaelement/interestforelement/index.md
chrisdavidmills e84ce14
Update files/en-us/web/api/htmlbuttonelement/interestforelement/index.md
chrisdavidmills 8f88046
Update files/en-us/web/api/htmlareaelement/index.md
chrisdavidmills 652fa81
Update files/en-us/web/api/htmlbuttonelement/index.md
chrisdavidmills 4b2af23
Update files/en-us/web/api/interestevent/index.md
chrisdavidmills ceab2d5
Update files/en-us/web/api/interestevent/index.md
chrisdavidmills eb987fd
A few more fixes for dipika review comments
chrisdavidmills 939f3ae
Update files/en-us/web/api/htmlelement/index.md
chrisdavidmills 167363b
Update files/en-us/web/api/htmlelement/interest_event/index.md
chrisdavidmills 46766c8
Update files/en-us/web/api/htmlelement/interest_event/index.md
chrisdavidmills 99c68ef
Update files/en-us/web/api/htmlelement/interest_event/index.md
chrisdavidmills 52d2420
Update files/en-us/web/api/htmlelement/interest_event/index.md
chrisdavidmills 1a79d88
Update files/en-us/web/api/htmlelement/interest_event/index.md
chrisdavidmills 7d8d994
Update files/en-us/web/api/htmlelement/interest_event/index.md
chrisdavidmills b66b9af
Update files/en-us/web/api/htmlelement/loseinterest_event/index.md
chrisdavidmills c796bc1
Update files/en-us/web/api/htmlelement/loseinterest_event/index.md
chrisdavidmills e6ce430
Update files/en-us/web/api/svgaelement/interestforelement/index.md
chrisdavidmills 3f8d0b3
Update files/en-us/web/api/svgaelement/interestforelement/index.md
chrisdavidmills 47d794f
Update files/en-us/web/api/svgaelement/interestforelement/index.md
chrisdavidmills 3c52df0
Update files/en-us/web/api/svgaelement/interestforelement/index.md
chrisdavidmills 4351cc6
Update files/en-us/web/api/svgaelement/interestforelement/index.md
chrisdavidmills 6f69d30
Update files/en-us/web/api/svgaelement/index.md
chrisdavidmills 8507e15
Update files/en-us/web/css/reference/properties/interest-delay-start/…
chrisdavidmills 86d87bd
Update files/en-us/web/css/reference/properties/interest-delay-end/in…
chrisdavidmills 5fba1bc
Update files/en-us/web/css/reference/properties/interest-delay-start/…
chrisdavidmills 5147382
Update files/en-us/web/css/reference/properties/interest-delay-end/in…
chrisdavidmills fec819c
Update files/en-us/web/css/reference/properties/interest-delay-start/…
chrisdavidmills 7e65243
Update files/en-us/web/css/reference/properties/interest-delay-end/in…
chrisdavidmills e65a51f
Update files/en-us/web/css/reference/properties/interest-delay-start/…
chrisdavidmills 815c268
Update files/en-us/web/css/reference/properties/interest-delay-start/…
chrisdavidmills 3423635
Update files/en-us/web/css/reference/properties/interest-delay-end/in…
chrisdavidmills cd8827e
Update files/en-us/web/css/reference/properties/interest-delay/index.md
chrisdavidmills 1e70559
Update files/en-us/web/css/reference/properties/interest-delay-start/…
chrisdavidmills 8479409
Update files/en-us/web/css/reference/properties/interest-delay-end/in…
chrisdavidmills b16f459
Update files/en-us/web/css/reference/properties/interest-delay-start/…
chrisdavidmills 225e416
Update files/en-us/web/css/reference/properties/interest-delay-start/…
chrisdavidmills 4d53afb
Update files/en-us/web/css/reference/properties/interest-delay-end/in…
chrisdavidmills 7594c0f
Update files/en-us/web/css/reference/properties/interest-delay-start/…
chrisdavidmills 5a15cb8
Update files/en-us/web/css/reference/properties/interest-delay-end/in…
chrisdavidmills 28e4e12
Update files/en-us/web/css/reference/properties/interest-delay-end/in…
chrisdavidmills fe4f475
Update files/en-us/web/css/reference/properties/interest-delay-start/…
chrisdavidmills 95712ad
Update files/en-us/web/css/reference/properties/interest-delay-end/in…
chrisdavidmills e224a37
Update files/en-us/web/css/reference/properties/interest-delay-start/…
chrisdavidmills 7fa40de
Update files/en-us/web/css/reference/properties/interest-delay-start/…
chrisdavidmills 15928ad
Update files/en-us/web/css/reference/properties/interest-delay-start/…
chrisdavidmills 33010d4
Update files/en-us/web/css/reference/properties/interest-delay-start/…
chrisdavidmills af6ae3c
Update files/en-us/web/css/reference/properties/interest-delay-start/…
chrisdavidmills 8e54157
Update files/en-us/web/css/reference/properties/interest-delay-start/…
chrisdavidmills 652cfd9
Dipika review fixes, plus fixes for broken markdown syntax
chrisdavidmills File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
files/en-us/web/api/htmlanchorelement/interestforelement/index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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><div></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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
files/en-us/web/api/htmlareaelement/interestforelement/index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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><div></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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
files/en-us/web/api/htmlbuttonelement/interestforelement/index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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><div></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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
dipikabh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - {{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) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.