Skip to content

Instantly share code, notes, and snippets.

@savetheclocktower
Created November 13, 2008 19:18
Show Gist options
  • Save savetheclocktower/24571 to your computer and use it in GitHub Desktop.
Save savetheclocktower/24571 to your computer and use it in GitHub Desktop.
Object.extend(NativeObject.prototype, function() {
function computeSomethingWhenAwesomeCapabilityIsAvailable() {
// ...
}
function computeSomethingWhenSomeStupidIEBugIsPresent() {
// ...
}
function computeSomethingTheNormalWay() {
// ...
}
var computeSomething = computeSomethingTheNormalWay;
if (testForCapability()) {
computeSomething = computeSomethingWhenAwesomeCapabilityIsAvailable;
} else if (testForStupidIEBug()){
computeSomething = computeSomethingWhenSomeStupidIEBugIsPresent;
}
return {
computeSomething: computeSomething
};
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment