Skip to content

Commit

Permalink
slice is undefined in .bind implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
aFarkas committed Feb 6, 2012
1 parent 56abcdb commit 9df99be
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modernizr.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ window.Modernizr = (function( window, document, undefined ) {

classes = [],

slice = classes.slice,

featureName, // used in testing loop


Expand Down Expand Up @@ -205,6 +207,7 @@ window.Modernizr = (function( window, document, undefined ) {
// http://es5.github.com/#x15.3.4.5

if (!Function.prototype.bind) {

Function.prototype.bind = function bind(that) {

var target = this;
Expand Down
11 changes: 11 additions & 0 deletions test/js/unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,18 @@ test("globals set up", function() {

});

test("bind is implemented", function() {

ok(Function.prototype.bind, 'bind is a member of Function.prototype');

var a = function(){
return this.modernizr;
};
a = a.bind({modernizr: 'just awsome'});

equals("just awsome", a(), 'bind works as expected');

});



Expand Down

0 comments on commit 9df99be

Please sign in to comment.