/usr/share/javascript/yui3/event-mouseenter/event-mouseenter-debug.js is in libjs-yui3-debug 3.5.1-1ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | /*
YUI 3.5.1 (build 22)
Copyright 2012 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('event-mouseenter', function(Y) {
/**
* <p>Adds subscription and delegation support for mouseenter and mouseleave
* events. Unlike mouseover and mouseout, these events aren't fired from child
* elements of a subscribed node.</p>
*
* <p>This avoids receiving three mouseover notifications from a setup like</p>
*
* <pre><code>div#container > p > a[href]</code></pre>
*
* <p>where</p>
*
* <pre><code>Y.one('#container').on('mouseover', callback)</code></pre>
*
* <p>When the mouse moves over the link, one mouseover event is fired from
* #container, then when the mouse moves over the p, another mouseover event is
* fired and bubbles to #container, causing a second notification, and finally
* when the mouse moves over the link, a third mouseover event is fired and
* bubbles to #container for a third notification.</p>
*
* <p>By contrast, using mouseenter instead of mouseover, the callback would be
* executed only once when the mouse moves over #container.</p>
*
* @module event
* @submodule event-mouseenter
*/
var domEventProxies = Y.Env.evt.dom_wrappers,
contains = Y.DOM.contains,
toArray = Y.Array,
noop = function () {},
config = {
proxyType: "mouseover",
relProperty: "fromElement",
_notify: function (e, property, notifier) {
var el = this._node,
related = e.relatedTarget || e[property];
if (el !== related && !contains(el, related)) {
notifier.fire(new Y.DOMEventFacade(e, el,
domEventProxies['event:' + Y.stamp(el) + e.type]));
}
},
on: function (node, sub, notifier) {
var el = Y.Node.getDOMNode(node),
args = [
this.proxyType,
this._notify,
el,
null,
this.relProperty,
notifier];
sub.handle = Y.Event._attach(args, { facade: false });
// node.on(this.proxyType, notify, null, notifier);
},
detach: function (node, sub) {
sub.handle.detach();
},
delegate: function (node, sub, notifier, filter) {
var el = Y.Node.getDOMNode(node),
args = [
this.proxyType,
noop,
el,
null,
notifier
];
sub.handle = Y.Event._attach(args, { facade: false });
sub.handle.sub.filter = filter;
sub.handle.sub.relProperty = this.relProperty;
sub.handle.sub._notify = this._filterNotify;
},
_filterNotify: function (thisObj, args, ce) {
args = args.slice();
if (this.args) {
args.push.apply(args, this.args);
}
var currentTarget = Y.delegate._applyFilter(this.filter, args, ce),
related = args[0].relatedTarget || args[0][this.relProperty],
e, i, len, ret, ct;
if (currentTarget) {
currentTarget = toArray(currentTarget);
for (i = 0, len = currentTarget.length && (!e || !e.stopped); i < len; ++i) {
ct = currentTarget[0];
if (!contains(ct, related)) {
if (!e) {
e = new Y.DOMEventFacade(args[0], ct, ce);
e.container = Y.one(ce.el);
}
e.currentTarget = Y.one(ct);
// TODO: where is notifier? args? this.notifier?
ret = args[1].fire(e);
if (ret === false) {
break;
}
}
}
}
return ret;
},
detachDelegate: function (node, sub) {
sub.handle.detach();
}
};
Y.Event.define("mouseenter", config, true);
Y.Event.define("mouseleave", Y.merge(config, {
proxyType: "mouseout",
relProperty: "toElement"
}), true);
}, '3.5.1' ,{requires:['event-synthetic']});
|