Skip to content
This repository
Browse code

passing JSHint

  • Loading branch information...
commit 004906447c38782d7d07875a14a74e0494b2bd5e 1 parent 3ff7b46
Dustin Diaz ded authored
2  Makefile
... ... @@ -0,0 +1,2 @@
  1 +boosh:
  2 + node make/build.js
314 ender.js
... ... @@ -0,0 +1,314 @@
  1 +/*!
  2 + * event.js - copyright @dedfat
  3 + * https://github.com/fat/bean
  4 + * Follow our software http://twitter.com/dedfat
  5 + * MIT License
  6 + */
  7 +//smooshing mootools eventy stuff and dean edwards eventy stuff
  8 +!function (context) {
  9 +
  10 + var _uid = 1,
  11 + overOut = /over|out/;
  12 +
  13 + function isDescendant(parent, child) {
  14 + var node = child.parentNode;
  15 + while (node != null) {
  16 + if (node == parent) {
  17 + return true;
  18 + }
  19 + node = node.parentNode;
  20 + }
  21 + return false;
  22 + }
  23 +
  24 + function retrieveEvents(element) {
  25 + return (element._events = element._events) || {};
  26 + }
  27 +
  28 + function retrieveUid(handler) {
  29 + return (handler._uid = handler._uid) || _uid++;
  30 + }
  31 +
  32 + function addNativeListener(element, type, fn) {
  33 + if (element.addEventListener) {
  34 + element.addEventListener(type, fn, false);
  35 + } else {
  36 + element.attachEvent('on' + type, fn);
  37 + }
  38 + }
  39 +
  40 + function removeNativeListener(element, type, fn) {
  41 + if (element.removeEventListener) {
  42 + element.removeEventListener(type, fn, false);
  43 + } else {
  44 + element.detachEvent('on' + type, fn);
  45 + }
  46 + }
  47 +
  48 + function fireNativeEvent(element, type) {
  49 + var evt;
  50 + if (document.createEventObject) {
  51 + evt = document.createEventObject();
  52 + return element.fireEvent('on' + type, evt);
  53 + }
  54 + else {
  55 + evt = document.createEvent("HTMLEvents");
  56 + evt.initEvent(type, true, true);
  57 + return !element.dispatchEvent(evt);
  58 + }
  59 + }
  60 +
  61 + function nativeHandler(element, fn) {
  62 + return function (event) {
  63 + event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
  64 + if (fn.call(element, event) === false) {
  65 + event.preventDefault();
  66 + event.stopPropagation();
  67 + }
  68 + };
  69 + }
  70 +
  71 + function addCustomListener(element, type, fn) {
  72 + if (element.addEventListener) {
  73 + element.addEventListener(type, fn, false);
  74 + } else {
  75 + element['_on' + type] = 0;
  76 + element.attachEvent("onpropertychange", function (event) {
  77 + if (event.propertyName == '_on' + type) {
  78 + fn.apply(element, arguments);
  79 + }
  80 + });
  81 + }
  82 + }
  83 +
  84 + function removeCustomListener(element, type, fn) {
  85 + if (element.addEventListener) {
  86 + element.removeEventListener(type, fn, false);
  87 + } else {
  88 + element.detachEvent("onpropertychange", fn);
  89 + }
  90 + }
  91 +
  92 + function fireCustomEvent(element, type) {
  93 + if (element.addEventListener) {
  94 + var customeEvent = document.createEvent("UIEvents");
  95 + customeEvent.initEvent(type, false, false);
  96 + element.dispatchEvent(fakeEvent);
  97 + } else {
  98 + element['_on' + type]++;
  99 + }
  100 + }
  101 +
  102 + function customHandler(custom, fn) {
  103 + return function (event) {
  104 + if (custom.condition.call(this, event)) {
  105 + return fn.call(this, event);
  106 + }
  107 + return true;
  108 + };
  109 + }
  110 +
  111 + function addEvent(element, type, fn) {
  112 + var events = retrieveEvents(element),
  113 + handlers = events[type];
  114 + if (!handlers) {
  115 + handlers = events[type] = {};
  116 + if (element["on" + type]) {
  117 + handlers[0] = element["on" + type];
  118 + }
  119 + }
  120 + var uid = retrieveUid(fn);
  121 + if (handlers[uid]) {
  122 + return element;
  123 + }
  124 + var custom = customEvents[type];
  125 + if (custom) {
  126 + if (custom.condition) {
  127 + fn = customHandler(custom, fn);
  128 + }
  129 + type = custom.base || type;
  130 + }
  131 + if (nativeEvents.indexOf(type) != -1) {
  132 + fn = nativeHandler(element, fn);
  133 + addNativeListener(element, type, fn);
  134 + } else {
  135 + addCustomListener(element, type, fn);
  136 + }
  137 + handlers[uid] = fn;
  138 + fn._uid = uid;
  139 + return element;
  140 + }
  141 +
  142 + function addEvents(element, events, fn) {
  143 + if (typeof events == 'object') {
  144 + for (var type in events) {
  145 + if (events.hasOwnProperty(type)) {
  146 + addEvent(element, type, events[type]);
  147 + }
  148 + }
  149 + } else {
  150 + addEvent(element, events, fn);
  151 + }
  152 + return element;
  153 + }
  154 +
  155 + function removeEvent(element, type, handler) {
  156 + var events = retrieveEvents(element);
  157 + if (!events || !events[type]) {
  158 + return element;
  159 + }
  160 + delete events[type][handler._uid];
  161 + if (customEvents[type] && !nativeEvents[customEvents[type].base]) {
  162 + removeCustomListener(element, type, handler, arguments[3]);
  163 + } else {
  164 + removeNativeListener(element, type, handler, arguments[3]);
  165 + }
  166 + return element;
  167 + }
  168 +
  169 + function removeEvents(element, events, fn) {
  170 + var type, uid, attached, typeEvents, event;
  171 + if (typeof events == 'object') {
  172 + for (event in events) {
  173 + if (events.hasOwnProperty(event)) {
  174 + removeEvent(element, event, events[event]);
  175 + }
  176 + }
  177 + return element;
  178 + }
  179 + attached = retrieveEvents(element);
  180 + if (!attached) {
  181 + return element;
  182 + }
  183 + if (!events) {
  184 + for (type in attached) {
  185 + removeEvents(element, type);
  186 + }
  187 + attached = null;
  188 + } else if (attached[events]) {
  189 + if (fn) {
  190 + removeEvent(element, events, fn);
  191 + } else {
  192 + typeEvents = attached[events];
  193 + for (uid in typeEvents) {
  194 + removeEvent(element, events, typeEvents[uid]);
  195 + }
  196 + delete attached[events];
  197 + }
  198 + }
  199 + return element;
  200 + }
  201 +
  202 + function fireEvent(element, type, args) {
  203 + if (customEvents[type]) {
  204 + fireCustomEvent(element, type, args);
  205 + } else {
  206 + fireNativeEvent(element, type);
  207 + }
  208 + }
  209 +
  210 + function cloneEvents(element, from, type) {
  211 + var events = retrieveEvents(from), eventType, typeEvents, k;
  212 + if (!events) {
  213 + return element;
  214 + }
  215 + if (!type) {
  216 + for (eventType in events) {
  217 + cloneEvents(element, from, eventType);
  218 + }
  219 + } else if (events[type]) {
  220 + typeEvents = events[type];
  221 + for (k in typeEvents) {
  222 + addEvent(element, type, typeEvents[k]);
  223 + }
  224 + }
  225 + return element;
  226 + }
  227 +
  228 + function fixEvent(e) {
  229 + var type = e.type;
  230 + e = e || {};
  231 + e.preventDefault = fixEvent.preventDefault;
  232 + e.stopPropagation = fixEvent.stopPropagation;
  233 + e.target = e.target || e.srcElement;
  234 + if (e.target.nodeType == 3) {
  235 + e.target = e.target.parentNode;
  236 + }
  237 + if (type.indexOf('key') != -1) {
  238 + if (e.which) {
  239 + e.keyCode = e.which;
  240 + }
  241 + } else if ((/click|mouse|menu/i).test(type)) {
  242 + e.rightClick = (e.which == 3) || (e.button == 2);
  243 + e.pos = { x: 0, y: 0 };
  244 + if (e.pageX || e.pageY) {
  245 + e.pos.x = e.pageX;
  246 + e.pos.y = e.pageY;
  247 + } else if (e.clientX || e.clientY) {
  248 + e.pos.x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
  249 + e.pos.y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
  250 + }
  251 + if ((overOut).test(type)) {
  252 + e.relatedTarget = e.relatedTarget || e[(type == 'mouseover' ? 'from' : 'to') + 'Element'];
  253 + }
  254 + }
  255 + }
  256 + fixEvent.preventDefault = function () {
  257 + this.returnValue = false;
  258 + };
  259 + fixEvent.stopPropagation = function () {
  260 + this.cancelBubble = true;
  261 + };
  262 +
  263 + var nativeEvents = [ 'click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', //mouse buttons
  264 + 'mousewheel', 'DOMMouseScroll', //mouse wheel
  265 + 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', //mouse movement
  266 + 'keydown', 'keypress', 'keyup', //keyboard
  267 + 'orientationchange', // mobile
  268 + 'touchstart', 'touchmove', 'touchend', 'touchcancel', // touch
  269 + 'gesturestart', 'gesturechange', 'gestureend', // gesture
  270 + 'focus', 'blur', 'change', 'reset', 'select', 'submit', //form elements
  271 + 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', //window
  272 + 'error', 'abort', 'scroll' //misc
  273 + ];
  274 +
  275 + function check(event) {
  276 + var related = event.relatedTarget;
  277 + if (related == null) {
  278 + return true;
  279 + }
  280 + if (!related) {
  281 + return false;
  282 + }
  283 + return (related != this && related.prefix != 'xul' && !/document/.test(this.toString()) && !isDescendant(this, related));
  284 + }
  285 +
  286 + var customEvents = {
  287 + mouseenter: {
  288 + base: 'mouseover',
  289 + condition: check
  290 + },
  291 + mouseleave: {
  292 + base: 'mouseout',
  293 + condition: check
  294 + },
  295 + mousewheel: {
  296 + base: (navigator.userAgent.indexOf("Firefox") != -1) ? 'DOMMouseScroll' : 'mousewheel'
  297 + }
  298 + };
  299 +
  300 + var evnt = {
  301 + add: addEvents,
  302 + remove: removeEvents,
  303 + clone: cloneEvents,
  304 + fire: fireEvent
  305 + };
  306 +
  307 + var oldEvnt = context.evnt;
  308 + evnt.noConflict = function () {
  309 + context.evnt = oldEvnt;
  310 + return this;
  311 + };
  312 + context.evnt = evnt;
  313 +
  314 +}(this);
8 ender.min.js
... ... @@ -0,0 +1,8 @@
  1 +/*!
  2 + * event.js - copyright @dedfat
  3 + * https://github.com/fat/bean
  4 + * Follow our software http://twitter.com/dedfat
  5 + * MIT License
  6 + *///smooshing mootools eventy stuff and dean edwards eventy stuff
  7 +
  8 +!function(a){function w(a){var b=a.relatedTarget;if(b==null)return!0;if(!b)return!1;return b!=this&&b.prefix!="xul"&&!/document/.test(this.toString())&&!d(this,b)}function u(a){var b=a.type;a=a||{},a.preventDefault=u.preventDefault,a.stopPropagation=u.stopPropagation,a.target=a.target||a.srcElement,a.target.nodeType==3&&(a.target=a.target.parentNode);if(b.indexOf("key")!=-1)a.which&&(a.keyCode=a.which);else if(/click|mouse|menu/i.test(b)){a.rightClick=a.which==3||a.button==2,a.pos={x:0,y:0};if(a.pageX||a.pageY)a.pos.x=a.pageX,a.pos.y=a.pageY;else if(a.clientX||a.clientY)a.pos.x=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,a.pos.y=a.clientY+document.body.scrollTop+document.documentElement.scrollTop;c.test(b)&&(a.relatedTarget=a.relatedTarget||a[(b=="mouseover"?"from":"to")+"Element"])}}function t(a,b,c){var d=e(b),f,g,h;if(!d)return a;if(!c)for(f in d)t(a,b,f);else if(d[c]){g=d[c];for(h in g)o(a,c,g[h])}return a}function s(a,b,c){x[b]?m(a,b,c):i(a,b)}function r(a,b,c){var d,f,g,h,i;if(typeof b=="object"){for(i in b)b.hasOwnProperty(i)&&q(a,i,b[i]);return a}g=e(a);if(!g)return a;if(!b){for(d in g)r(a,d);g=null}else if(g[b])if(c)q(a,b,c);else{h=g[b];for(f in h)q(a,b,h[f]);delete g[b]}return a}function q(a,b,c){var d=e(a);if(!d||!d[b])return a;delete d[b][c._uid],x[b]&&!v[x[b].base]?l(a,b,c,arguments[3]):h(a,b,c,arguments[3]);return a}function p(a,b,c){if(typeof b=="object")for(var d in b)b.hasOwnProperty(d)&&o(a,d,b[d]);else o(a,b,c);return a}function o(a,b,c){var d=e(a),h=d[b];h||(h=d[b]={},a["on"+b]&&(h[0]=a["on"+b]));var i=f(c);if(h[i])return a;var l=x[b];l&&(l.condition&&(c=n(l,c)),b=l.base||b),v.indexOf(b)!=-1?(c=j(a,c),g(a,b,c)):k(a,b,c),h[i]=c,c._uid=i;return a}function n(a,b){return function(c){if(a.condition.call(this,c))return b.call(this,c);return!0}}function m(a,b){if(a.addEventListener){var c=document.createEvent("UIEvents");c.initEvent(b,!1,!1),a.dispatchEvent(fakeEvent)}else a["_on"+b]++}function l(a,b,c){a.addEventListener?a.removeEventListener(b,c,!1):a.detachEvent("onpropertychange",c)}function k(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):(a["_on"+b]=0,a.attachEvent("onpropertychange",function(d){d.propertyName=="_on"+b&&c.apply(a,arguments)}))}function j(a,b){return function(c){c=c||u(((this.ownerDocument||this.document||this).parentWindow||window).event),b.call(a,c)===!1&&(c.preventDefault(),c.stopPropagation())}}function i(a,b){var c;if(document.createEventObject){c=document.createEventObject();return a.fireEvent("on"+b,c)}c=document.createEvent("HTMLEvents"),c.initEvent(b,!0,!0);return!a.dispatchEvent(c)}function h(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent("on"+b,c)}function g(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)}function f(a){return(a._uid=a._uid)||b++}function e(a){return(a._events=a._events)||{}}function d(a,b){var c=b.parentNode;while(c!=null){if(c==a)return!0;c=c.parentNode}return!1}var b=1,c=/over|out/;u.preventDefault=function(){this.returnValue=!1},u.stopPropagation=function(){this.cancelBubble=!0};var v=["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"],x={mouseenter:{base:"mouseover",condition:w},mouseleave:{base:"mouseout",condition:w},mousewheel:{base:navigator.userAgent.indexOf("Firefox")!=-1?"DOMMouseScroll":"mousewheel"}},y={add:p,remove:r,clone:t,fire:s},z=a.evnt;y.noConflict=function(){a.evnt=z;return this},a.evnt=y}(this)
24 make/build.js
... ... @@ -0,0 +1,24 @@
  1 +require('../support/smoosh').config({
  2 + "JAVASCRIPT": {
  3 + "DIST_DIR": "./",
  4 + "ender": [
  5 + "./src/copyright.js",
  6 + "./src/event.js"
  7 + ]
  8 + },
  9 + "JSHINT_OPTS": {
  10 + "boss": true,
  11 + "forin": true,
  12 + "curly": true,
  13 + "debug": false,
  14 + "devel": false,
  15 + "evil": false,
  16 + "regexp": false,
  17 + "undef": false,
  18 + "sub": false,
  19 + "white": true,
  20 + "indent": 2,
  21 + "whitespace": true,
  22 + "asi": false
  23 + }
  24 +}).run().build().analyze();
2  src/copyright.js
... ... @@ -1,6 +1,6 @@
140 src/event.js
... ... @@ -1,28 +1,29 @@
1 1 //smooshing mootools eventy stuff and dean edwards eventy stuff
2 2 !function (context) {
3 3
4   - var _uid = 1;
  4 + var _uid = 1,
  5 + overOut = /over|out/;
5 6
6 7 function isDescendant(parent, child) {
7   - var node = child.parentNode;
8   - while (node != null) {
9   - if (node == parent) {
10   - return true;
11   - }
12   - node = node.parentNode;
13   - }
14   - return false;
  8 + var node = child.parentNode;
  9 + while (node != null) {
  10 + if (node == parent) {
  11 + return true;
  12 + }
  13 + node = node.parentNode;
  14 + }
  15 + return false;
15 16 }
16 17
17   - function retrieveEvents (element) {
18   - return element._events = element._events || {};
  18 + function retrieveEvents(element) {
  19 + return (element._events = element._events) || {};
19 20 }
20 21
21   - function retrieveUid (handler) {
22   - return handler._uid = handler._uid || _uid++;
  22 + function retrieveUid(handler) {
  23 + return (handler._uid = handler._uid) || _uid++;
23 24 }
24 25
25   - function addNativeListener (element, type, fn) {
  26 + function addNativeListener(element, type, fn) {
26 27 if (element.addEventListener) {
27 28 element.addEventListener(type, fn, false);
28 29 } else {
@@ -30,7 +31,7 @@
30 31 }
31 32 }
32 33
33   - function removeNativeListener (element, type, fn){
  34 + function removeNativeListener(element, type, fn) {
34 35 if (element.removeEventListener) {
35 36 element.removeEventListener(type, fn, false);
36 37 } else {
@@ -38,34 +39,35 @@
38 39 }
39 40 }
40 41
41   - function fireNativeEvent (element, type) {
42   - if (document.createEventObject){
43   - var evt = document.createEventObject();
44   - return element.fireEvent('on'+type,evt)
  42 + function fireNativeEvent(element, type) {
  43 + var evt;
  44 + if (document.createEventObject) {
  45 + evt = document.createEventObject();
  46 + return element.fireEvent('on' + type, evt);
45 47 }
46 48 else {
47   - var evt = document.createEvent("HTMLEvents");
48   - evt.initEvent(type, true, true );
  49 + evt = document.createEvent("HTMLEvents");
  50 + evt.initEvent(type, true, true);
49 51 return !element.dispatchEvent(evt);
50 52 }
51 53 }
52 54
53   - function nativeHandler (element, fn) {
54   - return function(event){
  55 + function nativeHandler(element, fn) {
  56 + return function (event) {
55 57 event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
56 58 if (fn.call(element, event) === false) {
57 59 event.preventDefault();
58 60 event.stopPropagation();
59 61 }
60   - }
  62 + };
61 63 }
62 64
63   - function addCustomListener (element, type, fn) {
  65 + function addCustomListener(element, type, fn) {
64 66 if (element.addEventListener) {
65 67 element.addEventListener(type, fn, false);
66 68 } else {
67 69 element['_on' + type] = 0;
68   - element.attachEvent("onpropertychange", function(event) {
  70 + element.attachEvent("onpropertychange", function (event) {
69 71 if (event.propertyName == '_on' + type) {
70 72 fn.apply(element, arguments);
71 73 }
@@ -73,7 +75,7 @@
73 75 }
74 76 }
75 77
76   - function removeCustomListener (element, type, fn) {
  78 + function removeCustomListener(element, type, fn) {
77 79 if (element.addEventListener) {
78 80 element.removeEventListener(type, fn, false);
79 81 } else {
@@ -81,7 +83,7 @@
81 83 }
82 84 }
83 85
84   - function fireCustomEvent (element, type) {
  86 + function fireCustomEvent(element, type) {
85 87 if (element.addEventListener) {
86 88 var customeEvent = document.createEvent("UIEvents");
87 89 customeEvent.initEvent(type, false, false);
@@ -91,13 +93,13 @@
91 93 }
92 94 }
93 95
94   - function customHandler (custom, fn) {
95   - return function(event){
  96 + function customHandler(custom, fn) {
  97 + return function (event) {
96 98 if (custom.condition.call(this, event)) {
97 99 return fn.call(this, event);
98 100 }
99 101 return true;
100   - }
  102 + };
101 103 }
102 104
103 105 function addEvent(element, type, fn) {
@@ -151,38 +153,38 @@
151 153 }
152 154 delete events[type][handler._uid];
153 155 if (customEvents[type] && !nativeEvents[customEvents[type].base]) {
154   - removeCustomListener(element, type, handler, arguments[3])
  156 + removeCustomListener(element, type, handler, arguments[3]);
155 157 } else {
156 158 removeNativeListener(element, type, handler, arguments[3]);
157 159 }
158 160 return element;
159 161 }
160 162
161   - function removeEvents (element, events, fn) {
162   - var type;
  163 + function removeEvents(element, events, fn) {
  164 + var type, uid, attached, typeEvents, event;
163 165 if (typeof events == 'object') {
164   - for (var event in events) {
  166 + for (event in events) {
165 167 if (events.hasOwnProperty(event)) {
166 168 removeEvent(element, event, events[event]);
167 169 }
168 170 }
169   - return element
  171 + return element;
170 172 }
171   - var attached = retrieveEvents(element);
  173 + attached = retrieveEvents(element);
172 174 if (!attached) {
173 175 return element;
174 176 }
175 177 if (!events) {
176   - for (var type in attached) {
  178 + for (type in attached) {
177 179 removeEvents(element, type);
178 180 }
179   - delete attached;
180   - } else if (attached[events]){
  181 + attached = null;
  182 + } else if (attached[events]) {
181 183 if (fn) {
182 184 removeEvent(element, events, fn);
183 185 } else {
184   - var typeEvents = attached[events];
185   - for (var uid in typeEvents) {
  186 + typeEvents = attached[events];
  187 + for (uid in typeEvents) {
186 188 removeEvent(element, events, typeEvents[uid]);
187 189 }
188 190 delete attached[events];
@@ -191,7 +193,7 @@
191 193 return element;
192 194 }
193 195
194   - function fireEvent (element, type, args) {
  196 + function fireEvent(element, type, args) {
195 197 if (customEvents[type]) {
196 198 fireCustomEvent(element, type, args);
197 199 } else {
@@ -199,18 +201,18 @@
199 201 }
200 202 }
201 203
202   - function cloneEvents (element, from, type) {
203   - var events = retrieveEvents(from);
  204 + function cloneEvents(element, from, type) {
  205 + var events = retrieveEvents(from), eventType, typeEvents, k;
204 206 if (!events) {
205 207 return element;
206 208 }
207 209 if (!type) {
208   - for (var eventType in events) {
  210 + for (eventType in events) {
209 211 cloneEvents(element, from, eventType);
210 212 }
211 213 } else if (events[type]) {
212   - var typeEvents = events[type];
213   - for (var k in typeEvents) {
  214 + typeEvents = events[type];
  215 + for (k in typeEvents) {
214 216 addEvent(element, type, typeEvents[k]);
215 217 }
216 218 }
@@ -224,31 +226,31 @@
224 226 e.stopPropagation = fixEvent.stopPropagation;
225 227 e.target = e.target || e.srcElement;
226 228 if (e.target.nodeType == 3) {
227   - e.target = e.target.parentNode;
  229 + e.target = e.target.parentNode;
228 230 }
229   - if (type.indexOf('key') != -1){
  231 + if (type.indexOf('key') != -1) {
230 232 if (e.which) {
231 233 e.keyCode = e.which;
232 234 }
233 235 } else if ((/click|mouse|menu/i).test(type)) {
234   - e.rightClick = (e.which == 3) || (e.button == 2);
235   - e.pos = { x: 0, y: 0 };
236   - if (e.pageX || e.pageY) {
237   - e.pos.x = e.pageX;
238   - e.pos.y = e.pageY;
239   - } else if (e.clientX || e.clientY) {
240   - e.pos.x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
241   - e.pos.y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
242   - }
243   - if ((/over|out/).test(type)){
244   - e.relatedTarget = e.relatedTarget || e[(type == 'mouseover' ? 'from' : 'to') + 'Element'];
245   - }
246   - }
247   - };
248   - fixEvent.preventDefault = function() {
  236 + e.rightClick = (e.which == 3) || (e.button == 2);
  237 + e.pos = { x: 0, y: 0 };
  238 + if (e.pageX || e.pageY) {
  239 + e.pos.x = e.pageX;
  240 + e.pos.y = e.pageY;
  241 + } else if (e.clientX || e.clientY) {
  242 + e.pos.x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
  243 + e.pos.y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
  244 + }
  245 + if ((overOut).test(type)) {
  246 + e.relatedTarget = e.relatedTarget || e[(type == 'mouseover' ? 'from' : 'to') + 'Element'];
  247 + }
  248 + }
  249 + }
  250 + fixEvent.preventDefault = function () {
249 251 this.returnValue = false;
250 252 };
251   - fixEvent.stopPropagation = function() {
  253 + fixEvent.stopPropagation = function () {
252 254 this.cancelBubble = true;
253 255 };
254 256
@@ -264,7 +266,7 @@
264 266 'error', 'abort', 'scroll' //misc
265 267 ];
266 268
267   - var check = function(event){
  269 + function check(event) {
268 270 var related = event.relatedTarget;
269 271 if (related == null) {
270 272 return true;
@@ -273,7 +275,7 @@
273 275 return false;
274 276 }
275 277 return (related != this && related.prefix != 'xul' && !/document/.test(this.toString()) && !isDescendant(this, related));
276   - };
  278 + }
277 279
278 280 var customEvents = {
279 281 mouseenter: {
@@ -301,6 +303,6 @@
301 303 context.evnt = oldEvnt;
302 304 return this;
303 305 };
304   - context.evnt = evnt
  306 + context.evnt = evnt;
305 307
306 308 }(this);

0 comments on commit 0049064

Please sign in to comment.
Something went wrong with that request. Please try again.