Changeset 1530

Show
Ignore:
Timestamp:
05/05/09 03:03:43 (10 months ago)
Author:
eoghan@…
Message:

Skeleton of monitor function, like jQ live connect

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • mochikit/branches/selector_api/MochiKit/Selector.js

    r1529 r1530  
    6363        return MochiKit.Selector.mapSelector(MochiKit.Signal.connect, arguments); 
    6464    }, 
     65 
     66/* 
     67    monitor: function(element, selector, sig, objOrFunc, funcOrStr) { 
     68        if (sig === "onmouseenter" || sig === .. etc.){ 
     69            throw new Error("Cannot monitor mouse enter events") 
     70        } 
     71        if (selector starts with non child selector){ 
     72            attach to document 
     73        } else { 
     74            attach to element 
     75        } 
     76        MochiKit.Signal.connect(docOrEl, sig, function(e){ 
     77                // Inefficient search on selector 
     78                // Should do a 'reverse' selection 
     79                if (e.target() in findRelatedElements(selector, docOrEl){ 
     80                    // Call the func with e.src() == e.target() 
     81                    ?? var destPair = MochiKit.Signal._getDestPair(objOrFunc, funcOrStr); 
     82                    ?? var obj = destPair[0]; 
     83                    ?? var func = destPair[1]; 
     84                    ?? if (typeof(obj) == 'undefined' || obj === null) { 
     85                    ??   obj = src; 
     86                    ??} 
     87                    ??obj.apply(funcOrString) 
     88                } 
     89 
     90            }); 
     91    }, 
     92*/ 
    6593 
    6694    visit: function(selector, func, /* optional */ obj) {