Skip to content

Instantly share code, notes, and snippets.

@jhuttner
Created February 22, 2011 20:56
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 jhuttner/839373 to your computer and use it in GitHub Desktop.
Save jhuttner/839373 to your computer and use it in GitHub Desktop.
var unbind = function($tab, by_type) {
/*
* var types = {
* 'click': ['#selector_one', '#selector_two'],
* 'delegate': ['#selector_three'],
* 'live': ['#selector_four']
* }
* unbind($geoTab, types);
*/
for (var i in by_type) {
bound_elems = $tab.find(by_type[i].join(','));
if (i === 'delegate') {
bound_elems.undelegate(bound_elems);
} else if (i === 'live') {
bound_elems.die(bound_elems);
} else {
bound_elems.unbind(i, bound_elems);
}
}
}
@philgran
Copy link

this line:
} else if (i === 'live') {
bound_elems.undelegate(bound_elems);
} else {
should call the equivalent for live:
} else if (i === 'live') {
bound_elems.die(bound_elems);
} else {

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