Skip to content

Instantly share code, notes, and snippets.

@notmatt
Forked from silentrob/gist:2897913
Created June 8, 2012 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notmatt/2897994 to your computer and use it in GitHub Desktop.
Save notmatt/2897994 to your computer and use it in GitHub Desktop.
Broken code.
FMWK = { 'hulk' : 'smash' }
FMWK.button = function() {
  var _this = this;
console.log(this.hasOwnProperty('hulk') ? "HULK SMASH" : "");
this.el = document.createElement('button');
  ['hide','show'].forEach(function(method){
    FMWK.button.prototype[method] = function(){
      $(_this.el)[method].apply($(_this.el), Array.prototype.slice.call(arguments));
     }
  });
return this;
}
var b1 = new FMWK.button();
var b2 = new FMWK.button();
b1.hide() // fires on b2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment