npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

isellipsis

v2.0.2

Published

Find out if an HTML element displays ellipsis

Readme

isEllipsis

Coverage Status License Rate on Openbase


Find out if an HTML tag or an Input tag currently display ellipsis.

Usage

  • import { isEllipsis } from "isellipsis";
  • let value = isEllipsis(HTMLElement, usePlaceholder, returnType);
Variables
  • value : According the return type:
    • Number: Greater from zero indicates an ellipsis is shown. (NaN indiates error).
    • Boolean: true indicates an ellipsis is shown.
  • HTMLElement : Any HTML element such as DIV or Input etc.
  • usePlaceholder : (Optional) Indicates whenever to use the placeholder (default is true).
  • returnType: (Optional) Detarmine the type of the return. It can be Number or Boolean constructors (default is Number).

Overall

The isEllipsis returns a zero or greater number or true (acoriding to the returnType) only if the HTMLElement is set up for ellipsis and the content overflows the element content area. So, if the returned value is zero or greater or true the HTMLElement displays ellipsis (...).

Example

<style>
    INPUT {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 200px;
    }
</style>
<input id="some-info" type="text" placeholder="This is a long placeholder with ellipsis" />
<script>
    let someInfo = document.getElementById("some-info");
    if (isEllipsis(someInfo) > 0) {
        console.log("ellipsis is visible");
    }
    // or ...
    if (isEllipsis(someInfo, true, Boolean)) {
        console.log("ellipsis is visible");
    }
</script>    

Importent Note and explanation

For the isEllipsis to work correctly. You must set your element width to an integer and box-sizing to border-box. Otherwise there is a margin of error of 1 pixel!!! This due the fact that an element properties that isEllipsis relays upon such as clientWidth, scrollWidth and offsetWidth are integers. Even if the rendered width of the element is something like 120.8px (which happens a lot), the browser rounds those numbers and isEllipsis has no way knowing it. If the content of the element overflows by more the correct answer will be returned for sure. As I tested it a lot, if you do like mentioned above, it will work 100% correctly.

Have a good productive day :)

If you like this package please consider donation Click Here