diff --git a/source b/source index 90829546f9d..e9975ab7d61 100644 --- a/source +++ b/source @@ -84774,32 +84774,24 @@ dictionary DragEventInit : MouseEventInit { the user. The following demonstrates how one could reveal a popover in an output element.

-
<button id=submit>Submit</button>
-<p><output><span popover=manual></span></output></p>
+   
<img id="image" src="cat.js" alt="pretty kitten">
+<div id="tooltip" popover>
+  <output></output>
+  <button popovertarget="message" popovertargetaction="hide">x</button>
+</div>
 
 <script>
- const sBtn = document.getElementById("submit");
- const outSpan = document.querySelector("output [popover=manual]");
- let successMessage;
- let errorMessage;
-
- /* define logic for determining success of action
-  and determining the appropriate success or error
-  messages to use */
-
- sBtn.addEventListener("click", ()=> {
-  if ( success ) {
-   outSpan.textContent = successMessage;
-  }
-  else {
-   outSpan.textContent = errorMessage;
-  }
-  outSpan.showPopover();
+  const img = document.querySelector("#image")
+  const tooltip = document.querySelector("#tooltip")
+  const output = tooltip.querySelector("output")
 
-  setTimeout(function () {
-   outSpan.hidePopover();
-  }, 10000);
- });
+  img.addEventListener("pointerover", () => {
+    output.textContent = img.alt
+    tooltip.showPopover()
+  })
+  img.addEventListener("pointerleave", () => {
+    tooltip.hidePopover()
+  })
 </script>