~bjornt/lazr-js/prefetch-yui-3.5

« back to all changes in this revision

Viewing changes to src-js/lazrjs/yui/event/event-synthetic.js

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-01-14 23:32:29 UTC
  • mfrom: (197.1.7 yui-3.3.0)
  • Revision ID: launchpad@pqm.canonical.com-20110114233229-r6i4cazdiiw18o7p
Upgrade to YUI 3.3.0 [r=mars]

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3
3
Code licensed under the BSD License:
4
4
http://developer.yahoo.com/yui/license.html
5
 
version: 3.2.0
6
 
build: 2676
 
5
version: 3.3.0
 
6
build: 3167
7
7
*/
8
8
YUI.add('event-synthetic', function(Y) {
9
9
 
363
363
         */
364
364
        _on: function (args, delegate) {
365
365
            var handles  = [],
 
366
                extra    = this.processArgs(args, delegate),
366
367
                selector = args[2],
367
368
                method   = delegate ? 'delegate' : 'on',
368
369
                nodes, handle;
378
379
                return handle;
379
380
            }
380
381
 
381
 
            Y.each(nodes, function (node) {
 
382
            Y.Array.each(nodes, function (node) {
382
383
                var subArgs = args.slice(),
383
 
                    extra, filter;
 
384
                    filter;
384
385
 
385
386
                node = Y.one(node);
386
387
 
387
388
                if (node) {
388
 
                    extra = this.processArgs(subArgs, delegate);
389
 
 
390
389
                    if (delegate) {
391
390
                        filter = subArgs.splice(3, 1)[0];
392
391
                    }
439
438
 
440
439
            sub.node   = node;
441
440
            sub.filter = filter;
442
 
            sub._extra = extra;
 
441
            if (extra) {
 
442
                this.applyArgExtras(extra, sub);
 
443
            }
443
444
 
444
445
            Y.mix(dispatcher, {
445
446
                eventDef     : this,
458
459
        },
459
460
 
460
461
        /**
 
462
         * <p>Implementers MAY provide this method definition.</p>
 
463
         *
 
464
         * <p>Implement this function if you want extra data extracted during
 
465
         * processArgs to be propagated to subscriptions on a per-node basis.
 
466
         * That is to say, if you call <code>Y.on('xyz', fn, xtra, 'div')</code>
 
467
         * the data returned from processArgs will be shared
 
468
         * across the subscription objects for all the divs.  If you want each
 
469
         * subscription to receive unique information, do that processing
 
470
         * here.</p>
 
471
         *
 
472
         * <p>The default implementation adds the data extracted by processArgs
 
473
         * to the subscription object as <code>sub._extra</code>.</p>
 
474
         *
 
475
         * @method applyArgExtras
 
476
         * @param extra {any} Any extra data extracted from processArgs
 
477
         * @param sub {Subscription} the individual subscription
 
478
         */
 
479
        applyArgExtras: function (extra, sub) {
 
480
            sub._extra = extra;
 
481
        },
 
482
 
 
483
        /**
461
484
         * Removes the subscription from the Notifier registry.
462
485
         *
463
486
         * @method _unregisterSub
468
491
        _unregisterSub: function (sub) {
469
492
            var notifiers = SyntheticEvent.getRegistry(sub.node, this.type),
470
493
                i;
471
 
                
 
494
 
472
495
            if (notifiers) {
473
496
                for (i = notifiers.length - 1; i >= 0; --i) {
474
497
                    if (notifiers[i].sub === sub) {
496
519
                els    = (isString(target)) ?
497
520
                            query(target) : toArray(target),
498
521
                node, i, len, handles, j;
499
 
            
 
522
 
500
523
            // (type, fn, el, context, filter?) => (type, fn, context, filter?)
501
524
            args.splice(2, 1);
502
525
 
732
755
};
733
756
 
734
757
 
735
 
}, '3.2.0' ,{requires:['node-base', 'event-custom']});
 
758
}, '3.3.0' ,{requires:['node-base', 'event-custom']});