nas5w / javascript-tips-and-tidbits

A continuously-evolving compendium of javascript tips based on common areas of confusion or misunderstanding.
MIT License
1.2k stars 73 forks source link

DOM Manipulation #21

Closed franklyT closed 4 years ago

franklyT commented 5 years ago

Indicate that .bind needs to be polyfilled for <IE9 and as a result should probably not be used.

Binding the function like the following would be more advisable:

function $(id) { return typeof id == "string" ? document.getElementById(id) : id; }