Giter VIP home page Giter VIP logo

scrollwidthpolyfill's Introduction

Overview

This was created purely for polyfilling scrollWidth() for inputs, no other types of elements. On most sites the perf hit (which is about an additional 6ms per input) should be fine and will hopefully apply pressure to the MS Edge team to fix this bug but allow you to utilize Lea Verou's Stretchy Library

Which Browsers Need This?

Currently only IE and MS Edge need this polyfill, possibly Safari if padding isn't included (I haven't tested this). A bug has been opened against MS Edge to have this fixed.

Changelist

Version 1.1 This now has fallback to the previous scrollWidth so this is safe to use in conjuction with the regulare scrollWidth. Made a few perf improvements and made a change to take interop issues between IE11 and Edge.

Usage

It's pretty straight forward, just include the JS file on your site near </body> then call:

var el = document.getElementById("testInput");
var scrollWidth = el.scrollWidth // element == the element you want the scroll width of

Please submit bugs

If you find any bugs in this please let me know by opening an issue. Additionally I currently only have tests for <textarea> and <input type="text">. If there is desire for more I will add them depending on complexity.

License

This is released under the MIT License

Acknowledgement

Thank you to the following people for their help

  • Lea Verou
  • John-David Dalton

scrollwidthpolyfill's People

Contributors

gregwhitworth avatar

Stargazers

Lu Nelson avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.