An implementation of StretchText for JavaScript, which makes it possible to show and hide nested information on web pages. For details, demos, and instructions on using the library read this blog post. The original repo can be seen here: BradNeuberg/stretchtext.js
Our docs can be seen here: docs
The overarching goal was to convert the code from ES5 to ES6.
For this, we majorly changed the following.
- Converted variable declations which used
var
orlet
toconst
. - Using
arrow functions
. - Using
forEach()
instead ofArray.prototype.forEach()
for iterating. - Using
module.exports
- All the functions were initially declared inside the IIFE function. We declared a majority of them in the global scope.
The following are the changes made to HTML:
- Added lang attribute
- Changed user-scalable=no to initial-scale=1 to enable user to zoom (enhances accesibility)
- Added title tag, which is considered good practice.
- Changed all the color names to hsl which is more understandable to humans.
- Removed duplicate transition declarations. Redundant with modern browsers.
- Made the padding left and right into a single tag making the code concise and easy to read.
We used Jest, which is a JavaScript testing framework. It requires npm
.
Run jest
to run the tests.