~ubuntu-branches/ubuntu/raring/maas/raring-updates

« back to all changes in this revision

Viewing changes to src/maasserver/static/jslibs/yui/3.4.1/build/event-focus/event-focus-debug.js

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-07-03 17:42:37 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20120703174237-p8l0keuuznfg721k
Tags: 0.1+bzr709+dfsg-0ubuntu1
* New Upstream release
* debian/control:
  - Depends on python-celery, python-tempita, libjs-yui3-{full,min},
    libjs-raphael
* debian/maas.install:
  - Install apiclient, celeryconfig.py, maas-import-pxe-files, preseeds_v2.
  - Update to install various files from chroot, rather tha manually copy
    them from the source.
* debian/maas.links: symlink celeryconfig.py
* debian/maas.maas-celery.upstart: Add job.
* debian/rules:
  - Install celery upstart job.
  - Do not install jslibs as packages are now used.
  - Drop copying of maas_local_settings_sample.py as source now ships
    a maas_local_settings.py
* debian/patches:
  - 04-maas-http-fix.patch: Drop. Merged upstream.
  - 01-fix-database-settings.patch: Refreshed.
  - 99_enums_js.patch: Added until creation of enum.js / build process
    is fixed.
* debian/maas.postinst: Update bzr version to correctly handle upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
YUI 3.4.1 (build 4118)
3
 
Copyright 2011 Yahoo! Inc. All rights reserved.
4
 
Licensed under the BSD License.
5
 
http://yuilibrary.com/license/
6
 
*/
7
 
YUI.add('event-focus', function(Y) {
8
 
 
9
 
/**
10
 
 * Adds bubbling and delegation support to DOM events focus and blur.
11
 
 * 
12
 
 * @module event
13
 
 * @submodule event-focus
14
 
 */
15
 
var Event    = Y.Event,
16
 
    YLang    = Y.Lang,
17
 
    isString = YLang.isString,
18
 
    useActivate = YLang.isFunction(
19
 
        Y.DOM.create('<p onbeforeactivate=";"/>').onbeforeactivate);
20
 
 
21
 
function define(type, proxy, directEvent) {
22
 
    var nodeDataKey = '_' + type + 'Notifiers';
23
 
 
24
 
    Y.Event.define(type, {
25
 
 
26
 
        _attach: function (el, notifier, delegate) {
27
 
            if (Y.DOM.isWindow(el)) {
28
 
                return Event._attach([type, function (e) {
29
 
                    notifier.fire(e);
30
 
                }, el]);
31
 
            } else {
32
 
                return Event._attach(
33
 
                    [proxy, this._proxy, el, this, notifier, delegate],
34
 
                    { capture: true });
35
 
            }
36
 
        },
37
 
 
38
 
        _proxy: function (e, notifier, delegate) {
39
 
            var node       = e.target,
40
 
                notifiers  = node.getData(nodeDataKey),
41
 
                yuid       = Y.stamp(e.currentTarget._node),
42
 
                defer      = (useActivate || e.target !== e.currentTarget),
43
 
                sub        = notifier.handle.sub,
44
 
                filterArgs = [node, e].concat(sub.args || []),
45
 
                directSub;
46
 
                
47
 
            notifier.currentTarget = (delegate) ? node : e.currentTarget;
48
 
            notifier.container     = (delegate) ? e.currentTarget : null;
49
 
 
50
 
            if (!sub.filter || sub.filter.apply(node, filterArgs)) {
51
 
                // Maintain a list to handle subscriptions from nested
52
 
                // containers div#a>div#b>input #a.on(focus..) #b.on(focus..),
53
 
                // use one focus or blur subscription that fires notifiers from
54
 
                // #b then #a to emulate bubble sequence.
55
 
                if (!notifiers) {
56
 
                    notifiers = {};
57
 
                    node.setData(nodeDataKey, notifiers);
58
 
 
59
 
                    // only subscribe to the element's focus if the target is
60
 
                    // not the current target (
61
 
                    if (defer) {
62
 
                        directSub = Event._attach(
63
 
                            [directEvent, this._notify, node._node]).sub;
64
 
                        directSub.once = true;
65
 
                    }
66
 
                }
67
 
 
68
 
                if (!notifiers[yuid]) {
69
 
                    notifiers[yuid] = [];
70
 
                }
71
 
 
72
 
                notifiers[yuid].push(notifier);
73
 
 
74
 
                if (!defer) {
75
 
                    this._notify(e);
76
 
                }
77
 
            }
78
 
        },
79
 
 
80
 
        _notify: function (e, container) {
81
 
            var node        = e.currentTarget,
82
 
                notifiers   = node.getData(nodeDataKey),
83
 
                              // document.get('ownerDocument') returns null
84
 
                doc         = node.get('ownerDocument') || node,
85
 
                target      = node,
86
 
                nots        = [],
87
 
                notifier, i, len;
88
 
 
89
 
            if (notifiers) {
90
 
                // Walk up the parent axis until the origin node, 
91
 
                while (target && target !== doc) {
92
 
                    nots.push.apply(nots, notifiers[Y.stamp(target)] || []);
93
 
                    target = target.get('parentNode');
94
 
                }
95
 
                nots.push.apply(nots, notifiers[Y.stamp(doc)] || []);
96
 
 
97
 
                for (i = 0, len = nots.length; i < len; ++i) {
98
 
                    notifier = nots[i];
99
 
                    e.currentTarget = nots[i].currentTarget;
100
 
 
101
 
                    if (notifier.container) {
102
 
                        e.container = notifier.container;
103
 
                    }
104
 
 
105
 
                    notifier.fire(e);
106
 
                }
107
 
 
108
 
                // clear the notifications list (mainly for delegation)
109
 
                node.clearData(nodeDataKey);
110
 
            }
111
 
        },
112
 
 
113
 
        on: function (node, sub, notifier) {
114
 
            sub.onHandle = this._attach(node._node, notifier);
115
 
        },
116
 
 
117
 
        detach: function (node, sub) {
118
 
            sub.onHandle.detach();
119
 
        },
120
 
 
121
 
        delegate: function (node, sub, notifier, filter) {
122
 
            if (isString(filter)) {
123
 
                sub.filter = Y.delegate.compileFilter(filter);
124
 
            }
125
 
 
126
 
            sub.delegateHandle = this._attach(node._node, notifier, true);
127
 
        },
128
 
 
129
 
        detachDelegate: function (node, sub) {
130
 
            sub.delegateHandle.detach();
131
 
        }
132
 
    }, true);
133
 
}
134
 
 
135
 
// For IE, we need to defer to focusin rather than focus because
136
 
// `el.focus(); doSomething();` executes el.onbeforeactivate, el.onactivate,
137
 
// el.onfocusin, doSomething, then el.onfocus.  All others support capture
138
 
// phase focus, which executes before doSomething.  To guarantee consistent
139
 
// behavior for this use case, IE's direct subscriptions are made against
140
 
// focusin so subscribers will be notified before js following el.focus() is
141
 
// executed.
142
 
if (useActivate) {
143
 
    //     name     capture phase       direct subscription
144
 
    define("focus", "beforeactivate",   "focusin");
145
 
    define("blur",  "beforedeactivate", "focusout");
146
 
} else {
147
 
    define("focus", "focus", "focus");
148
 
    define("blur",  "blur",  "blur");
149
 
}
150
 
 
151
 
 
152
 
}, '3.4.1' ,{requires:['event-synthetic']});