Tlite is an extremely lightweight, dependency-free utility designed for displaying simple tooltips. Weighing in at approximately 800 bytes minified and gzipped, it focuses on minimal overhead. The package, currently at version 0.1.9, has seen no updates since 2018, indicating an abandoned or legacy status. It leverages event delegation for efficient operation on dynamic web pages and boasts broad browser compatibility, including IE9+ and modern browsers. A key differentiator is its small footprint and no external dependencies, contrasting with more feature-rich but heavier tooltip libraries. However, it lacks modern accessibility features, built-in HTML escaping for content, and advanced positioning/collision detection found in actively maintained alternatives.
npm install tliteVerified import paths — ran on the pinned version, not inferred.
Demonstrates initializing Tlite with a selector function and manually showing/hiding a tooltip on a target element. Requires accompanying HTML elements to function.
Wrap contentless tags in a parent element (e.g., `<span>` or `<div>`) and apply the tooltip binding to the wrapper element instead.
Always sanitize or escape any user-generated content before rendering it within tooltip attributes (e.g., `element.setAttribute('title', escapeHTML(userInput))`) to prevent malicious script injection.Implement custom event listeners for window `resize` events. In your resize handler, either reposition the tooltip using `tlite.show(target, { grav: '...' })` or hide it with `tlite.hide(target)`.Apply the `tlite-table` class to the `<table>` element containing the tooltip target to improve positioning accuracy.
Ensure `tlite.js` is included in your HTML `<script>` tag before your application script, or `import tlite from 'tlite';` at the top of your module. If using it with a global script, place script tags appropriately for execution order.
Wrap the `<img>` or `<input>` element in a `<span>` or `<div>` and apply the `title` attribute or `data-tlite` to the wrapper element. Then, initialize tlite to target the wrapper.
Before setting any attribute used by tlite (like `title` or `data-tlite`) with user-generated input, ensure the input is thoroughly sanitized or HTML-escaped on the server-side or client-side (e.g., using a library like `DOMPurify`).
Add a JavaScript event listener for the `window.onresize` event. Inside this handler, either explicitly call `tlite.hide(targetElement)` to close the tooltip or re-call `tlite.show(targetElement, { grav: '...' })` with updated positioning logic.No dependency data recorded yet.