textwidth

1.0.0 • Public • Published

textwidth

Get some text's offsetWidth without rendering it in the DOM

Usage

Define a style you want to compute:

var element = document.getElementById('foo');
 
textwidth.define('styleName', element);

Then, once defined, compute a string's width in that style like so:

textwidth.get('styleName', 'string whose width to compute');

Compatability

All browsers IE5 and up (in theory - untested in not-Webkit!)

How do I use this with package manager X?

Yes.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    4
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    4

Package Sidebar

Install

npm i textwidth

Weekly Downloads

4

Version

1.0.0

License

MIT

Last publish

Collaborators

  • bcherny