cheeriojs/cheerio — pull request #552 by jugglinmike (2014-08-19 23:33:35+00:00)
Title: Return a fully-qualified Function from `$.load`

This should resolve #550.

An alternative implementation would involve defining `module.exports` as a no-op function in `lib/static.js`. If the static methods were attached to this function (i.e. `module.exports.html`), then when the `__proto__` attribute of the new function was re-set, the resulting object would have `Function.prototype` in its prototype chain. I opted for this approach because, while slower (the call to `_.merge` requires more work than simply setting an attribute), I've never been comfortable using `__proto__`, and I don't think we need to heavily optimize `$.load`.

Commit message:

> The function generated by `$.load` should inherit from the `Function`
> prototype so that methods like `call`, `apply`, and `bind` are available
> to users.