New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change `fnBind` to a normal lib function instead of a polyfill #1278

Merged
merged 1 commit into from Apr 23, 2014

Conversation

Projects
None yet
3 participants
@stucox
Member

stucox commented Mar 25, 2014

I know we document it, but it’s pretty hidden and might surprise some people. Also it could cause the fn.bind detect to fail (haven’t checked this though) – and generally I don’t think Modernizr should be changing the environment that low down, certainly not without an explicit opt-in.

It was added way back in #478, but that ticket ended up just discussing the API for prefixed() and didn’t discuss whether to polyfill or implement as a library function.

Also relevant: this chap reckons polyfills shouldn’t be AMD dependencies – and I think I agree. Maybe.

@ryanseddon

This comment has been minimized.

Member

ryanseddon commented Mar 26, 2014

Yep makes sense to me. Good one.

F.prototype = target.prototype;
var self = new F();
if (fn instanceof bound) {
console.log('bound');

This comment has been minimized.

@ryanseddon

ryanseddon Mar 26, 2014

Member

remove please

console.log(that);
console.log(slice.call(arguments));
/* jshint -W087 */
debugger;

This comment has been minimized.

@ryanseddon

ryanseddon Mar 26, 2014

Member

Also these

This comment has been minimized.

@stucox

stucox Mar 26, 2014

Member

Bah, I removed them but failed to commit/push! Done.

@stucox

This comment has been minimized.

Member

stucox commented Mar 26, 2014

Left over debugging removed.

@patrickkettner

This comment has been minimized.

Member

patrickkettner commented Mar 26, 2014

lgtm

if (!Function.prototype.bind) {
Function.prototype.bind = function bind(that) {
function fnBind (fn, that) {

This comment has been minimized.

@ryanseddon

ryanseddon Mar 27, 2014

Member

Should we have a check for bind and use it if available otherwise fallback to this.

This comment has been minimized.

@stucox

stucox Mar 27, 2014

Member

That sounds like the kind of thing a feature detection library would do, yes. I’ll update the PR.

@stucox stucox self-assigned this Mar 28, 2014

@ryanseddon

This comment has been minimized.

Member

ryanseddon commented Apr 22, 2014

ping @stucox

Change `fnBind` to a normal lib function instead of a polyfill
Removing Function.bind unit test

Removing unneded global declaration

Removing debug statements

Using native fn.bind if available
@stucox

This comment has been minimized.

Member

stucox commented Apr 22, 2014

Done!

@stucox stucox added this to the Modernizr v3 milestone Apr 22, 2014

ryanseddon added a commit that referenced this pull request Apr 23, 2014

Merge pull request #1278 from stucox/fnbind
Change `fnBind` to a normal lib function instead of a polyfill

@ryanseddon ryanseddon merged commit 72616be into Modernizr:master Apr 23, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

jtangelder added a commit to jtangelder/Modernizr that referenced this pull request Apr 24, 2014

@stucox stucox referenced this pull request May 21, 2014

Closed

v3.0 release notes #805

patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this pull request Feb 22, 2015

Merge pull request Modernizr#1278 from stucox/fnbind
Change `fnBind` to a normal lib function instead of a polyfill

@anselmbradford anselmbradford referenced this pull request Apr 5, 2016

Closed

Docs outdated? #34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment