JSAPI.info

dojo._connect

Dojo (1.6.1) - see full source
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
dojo._connect = function(obj, event, context, method, dontFix){
    // FIXME: need a more strict test
    var isNode = obj && (obj.nodeType||obj.attachEvent||obj.addEventListener);
    // choose one of three listener options: raw (connect.js), DOM event on a Node, custom event on a Node
    // we need the third option to provide leak prevention on broken browsers (IE)
    var lid = isNode ? (dontFix ? 2 : 1) : 0, l = [dojo._listener, del, node_listener][lid];
    // create a listener
    var h = l.add(obj, event, dojo.hitch(context, method));
    // formerly, the disconnect package contained "l" directly, but if client code
    // leaks the disconnect package (by connecting it to a node), referencing "l"
    // compounds the problem.
    // instead we return a listener id, which requires custom _disconnect below.
    // return disconnect package
    return [ obj, event, h, lid ];
};