arielsalminen / feature.js

Feature.js is a fast, simple and lightweight browser feature detection library in 1kb.
https://featurejs.com/
3.17k stars 115 forks source link

Consider binding for create() #29

Closed jbmonroe closed 5 years ago

jbmonroe commented 8 years ago

Instead of

create : function (el) { return document.createElement(el); },

use

create : document.createElement.bind(document),

I infer that you're not doing IE8 support, and everything else supports Function#bind. It's kind of a performance enhancement, but maybe not worth it.

meowsus commented 5 years ago

Though IE 8 isn't specifically called out in the README as a device that this library is tested against, it would make sense for a feature detection library to try to detect features in as many browsers as possible, no? I have an inkling that the performance boon here would be minimal, but feel free to prove me wrong with a benchmark test :)