ginader / HTML5-placeholder-polyfill

Small and robust polyfill for the HTML5 placeholder attribut.
GNU General Public License v2.0
223 stars 85 forks source link

Reduce CSS changes when input is focused #62

Open rockallite opened 10 years ago

rockallite commented 10 years ago

When an input is focused, the requestAnimationFrame check loop should change CSS only when it is necessary.

So instead of repeatedly calling showPlaceholderIfEmpty() (which calls removeClass() or addClass() all the time) in the check loop, we should polling input.val() and call hidePlaceholder() or showPlaceholder() only when the boundary condition is satisfied.