PageSourceSearch

https://twistedsifter.com/wp-includes/js/wp-tooltip.js?m=1790088692g

js twistedsifter.com collected 2026-09-24 08:41:15 UTC 1,846 bytes, 60 lines download raw bytes

1/**
2 * @output wp-admin/js/wp-tooltip.js
3 */
4
5/**
6 * Add focus and hover support for the 'tooltip' type in `wp_tooltip()`.
7 * This script can be made obsolete when support is available for Interest Invokers.
8 */
9(() => {
10
11	const supportsPopover = /** @type {boolean} */ ( Object.prototype.hasOwnProperty.call( HTMLElement.prototype, 'popover' ) );
12	let hidePopover = false;
13	if ( ! supportsPopover ) {
14		hidePopover = true;
15	}
16
17	const popovers = /** @type {NodeListOf<HTMLSpanElement>} */ ( document.querySelectorAll( '.wp-is-tooltip' ) );
18
19	popovers.forEach( function( popover ) {
20		const trigger = /** @type {HTMLButtonElement|HTMLAnchorElement|null} */ ( popover.querySelector( '.wp-tooltip__toggle' ) );
21		const panel   = /** @type {HTMLSpanElement|null} */ ( popover.querySelector( 'span.wp-tooltip__bubble' ) );
22		if ( hidePopover && panel ) {
23			panel.classList.add( 'hidden' );
24
25			return;
26		}
27		if ( ! trigger || ! panel ) {
28			return;
29		}
30
31		/** @type {ReturnType<typeof setTimeout>} */
32		let openTimeout;
33
34		// Show Tooltip Function (with delay to prevent flickering).
35		const showTooltip = () => {
36			clearTimeout( openTimeout );
37			openTimeout = setTimeout( () => {
38				// Only show if it's not already open.
39				if ( ! panel.matches( ':popover-open' ) ) {
40					// pass the triggering element so implicit position anchors work.
41					panel.showPopover( { source: trigger } );
42				}
43			}, 300 );
44		};
45		// Hide Tooltip Function.
46		const hideTooltip = () => {
47			clearTimeout( openTimeout );
48			if ( panel.matches( ':popover-open' ) ) {
49				panel.hidePopover();
50			}
51		};
52
53		// Bind Hover and Focus Events.
54		trigger.addEventListener( 'mouseenter', showTooltip );
55		trigger.addEventListener( 'focus', showTooltip );
56
57		trigger.addEventListener( 'mouseleave', hideTooltip );
58		trigger.addEventListener( 'blur', hideTooltip );
59	});
60})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.