Created
September 15, 2009 17:26
-
-
Save tivac/187468 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Assume all code is wrapped within each respective library's DOMReady handler | |
//Scope-corrected callback in YUI 2 | |
YAHOO.util.Event("id", "click", function(e) { | |
this._methodName(); | |
}, null, this); | |
//Scope-corrected callback in YUI 3 | |
Y.on("click", function(e) { | |
this._methodName(); | |
}, "#id", this); | |
//Scope-corrected callback in jQuery 1.3.0 | |
var that = this; | |
var cb = function(e) { | |
this._methodName(); | |
} | |
$("#id").click(function(e) { cb.call(this, e); })) | |
//Scope-corrected callback in jQuery 1.3.0 using hitch plugin | |
$("#id").click($.hitch(this, function(e) { | |
this._methodName(); | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment