New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bean

Package Overview
Dependencies
Maintainers
0
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bean - npm Package Compare versions

Comparing version 0.0.35 to 0.1.0

integration/ender.min.js

168

bean.js

@@ -19,5 +19,9 @@ /*!

removeEvent = 'removeEventListener',
detachEvent = 'detachEvent';
detachEvent = 'detachEvent',
doc = context.document || {},
root = doc.documentElement || {},
W3C_MODEL = root[addEvent],
eventSupport = W3C_MODEL ? addEvent : attachEvent,
function isDescendant(parent, child) {
isDescendant = function (parent, child) {
var node = child.parentNode;

@@ -30,23 +34,21 @@ while (node != null) {

}
}
},
function retrieveEvents(element) {
retrieveUid = function (obj, uid) {
return (obj.__uid = uid || obj.__uid || __uid++);
},
retrieveEvents = function (element) {
var uid = retrieveUid(element);
return (registry[uid] = registry[uid] || {});
}
},
function retrieveUid(obj, uid) {
return (obj.__uid = uid || obj.__uid || __uid++);
}
listener = W3C_MODEL ? function (element, type, fn, add) {
element[add ? addEvent : removeEvent](type, fn, false);
} : function (element, type, fn, add, custom) {
custom && add && (element['_on' + custom] = element['_on' + custom] || 0);
element[add ? attachEvent : detachEvent]('on' + type, fn);
},
function listener(element, type, fn, add, custom) {
if (element[addEvent]) {
element[add ? addEvent : removeEvent](type, fn, false);
} else if (element[attachEvent]) {
custom && add && (element['_on' + custom] = element['_on' + custom] || 0);
element[add ? attachEvent : detachEvent]('on' + type, fn);
}
}
function nativeHandler(element, fn, args) {
nativeHandler = function (element, fn, args) {
return function (event) {

@@ -56,5 +58,5 @@ event = fixEvent(event || ((this.ownerDocument || this.document || this).parentWindow || context).event);

};
}
},
function customHandler(element, fn, type, condition, args) {
customHandler = function (element, fn, type, condition, args) {
return function (event) {

@@ -65,6 +67,7 @@ if (condition ? condition.call(this, event) : event && event.propertyName == '_on' + type || !event) {

};
}
},
function addListener(element, orgType, fn, args) {
var type = orgType.replace(stripName, ''), events = retrieveEvents(element),
addListener = function (element, orgType, fn, args) {
var type = orgType.replace(stripName, ''),
events = retrieveEvents(element),
handlers = events[type] || (events[type] = {}),

@@ -76,5 +79,7 @@ uid = retrieveUid(fn, orgType.replace(namespace, ''));

var custom = customEvents[type];
fn = custom && custom.condition ? customHandler(element, fn, type, custom.condition) : fn;
type = custom && custom.base || type;
var isNative = context[addEvent] || nativeEvents.indexOf(type) > -1;
if (custom) {
fn = custom.condition ? customHandler(element, fn, type, custom.condition) : fn;
type = custom.base || type;
}
var isNative = W3C_MODEL || nativeEvents.indexOf(type) > -1;
fn = isNative ? nativeHandler(element, fn, args) : customHandler(element, fn, type, false, args);

@@ -87,9 +92,9 @@ if (type == 'unload') {

}
listener(element, isNative ? type : 'propertychange', fn, true, !isNative && true);
element[eventSupport] && listener(element, isNative ? type : 'propertychange', fn, true, !isNative && type);
handlers[uid] = fn;
fn.__uid = uid;
return type == 'unload' ? element : (collected[retrieveUid(element)] = element);
}
},
function removeListener(element, orgType, handler) {
removeListener = function (element, orgType, handler) {
var uid, names, uids, i, events = retrieveEvents(element), type = orgType.replace(stripName, '');

@@ -105,10 +110,12 @@ if (!events || !events[type]) {

delete events[type][uid];
type = customEvents[type] ? customEvents[type].base : type;
var isNative = element[addEvent] || nativeEvents.indexOf(type) > -1;
listener(element, isNative ? type : 'propertychange', handler, false, !isNative && type);
if (element[eventSupport]) {
type = customEvents[type] ? customEvents[type].base : type;
var isNative = element[addEvent] || nativeEvents.indexOf(type) > -1;
listener(element, isNative ? type : 'propertychange', handler, false, !isNative && type);
}
}
return element;
}
},
function del(selector, fn, $) {
del = function (selector, fn, $) {
return function (e) {

@@ -124,5 +131,5 @@ var array = typeof selector == 'string' ? $(selector, this) : selector;

};
}
},
function add(element, events, fn, delfn, $) {
add = function (element, events, fn, delfn, $) {
if (typeof events == 'object' && !fn) {

@@ -140,5 +147,5 @@ for (var type in events) {

return element;
}
},
function remove(element, orgEvents, fn) {
remove = function (element, orgEvents, fn) {
var k, type, events,

@@ -172,5 +179,5 @@ isString = typeof(orgEvents) == 'string',

return element;
}
},
function fire(element, type) {
fire = function (element, type) {
var evt, k, i, types = type.split(' ');

@@ -187,8 +194,4 @@ for (i = types.length; i--;) {

}
} else if (element[addEvent]) {
evt = document.createEvent(isNative ? "HTMLEvents" : "UIEvents");
evt[isNative ? 'initEvent' : 'initUIEvent'](type, true, true, context, 1);
element.dispatchEvent(evt);
} else if (element[attachEvent]) {
isNative ? element.fireEvent('on' + type, document.createEventObject()) : element['_on' + type]++;
} else if (element[eventSupport]) {
fireListener(isNative, type, element);
} else {

@@ -201,5 +204,13 @@ for (k in handlers) {

return element;
}
},
function clone(element, from, type) {
fireListener = W3C_MODEL ? function (isNative, type, element) {
evt = document.createEvent(isNative ? "HTMLEvents" : "UIEvents");
evt[isNative ? 'initEvent' : 'initUIEvent'](type, true, true, context, 1);
element.dispatchEvent(evt);
} : function (isNative, type, element) {
isNative ? element.fireEvent('on' + type, document.createEventObject()) : element['_on' + type]++;
},
clone = function (element, from, type) {
var events = retrieveEvents(from), obj, k;

@@ -211,35 +222,56 @@ obj = type ? events[type] : events;

return element;
}
},
function fixEvent(e) {
fixEvent = function (e) {
var result = {};
if (!e) {
return {};
return result;
}
var type = e.type, target = e.target || e.srcElement;
e.preventDefault = e.preventDefault || fixEvent.preventDefault;
e.stopPropagation = e.stopPropagation || fixEvent.stopPropagation;
e.target = target && target.nodeType == 3 ? target.parentNode : target;
result.preventDefault = fixEvent.preventDefault(e);
result.stopPropagation = fixEvent.stopPropagation(e);
result.target = target && target.nodeType == 3 ? target.parentNode : target;
if (type.indexOf('key') != -1) {
e.keyCode = e.which || e.keyCode;
result.keyCode = e.which || e.keyCode;
} else if ((/click|mouse|menu/i).test(type)) {
e.rightClick = e.which == 3 || e.button == 2;
e.pos = { x: 0, y: 0 };
result.rightClick = e.which == 3 || e.button == 2;
result.pos = { x: 0, y: 0 };
if (e.pageX || e.pageY) {
e.pos.x = e.pageX;
e.pos.y = e.pageY;
result.clientX = e.pageX;
result.clientY = e.pageY;
} else if (e.clientX || e.clientY) {
e.pos.x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
e.pos.y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
result.clientX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
result.clientY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
}
overOut.test(type) && (e.relatedTarget = e.relatedTarget || e[(type == 'mouseover' ? 'from' : 'to') + 'Element']);
overOut.test(type) && (result.relatedTarget = e.relatedTarget || e[(type == 'mouseover' ? 'from' : 'to') + 'Element']);
}
return e;
}
fixEvent.preventDefault = function () {
this.returnValue = false;
for (var k in e) {
if (!(k in result)) {
result[k] = e[k];
}
}
return result;
};
fixEvent.stopPropagation = function () {
this.cancelBubble = true;
fixEvent.preventDefault = function (e) {
return function () {
if (e.preventDefault) {
e.preventDefault();
}
else {
e.returnValue = false;
}
};
};
fixEvent.stopPropagation = function (e) {
return function () {
if (e.stopPropagation) {
e.stopPropagation();
} else {
e.cancelBubble = true;
}
};
};
var nativeEvents = 'click,dblclick,mouseup,mousedown,contextmenu,' + //mouse buttons

@@ -246,0 +278,0 @@ 'mousewheel,DOMMouseScroll,' + //mouse wheel

@@ -11,2 +11,2 @@ /*!

*/
!function(a){function A(a){var b=a.relatedTarget;if(!b)return b==null;return b!=this&&b.prefix!="xul"&&!/document/.test(this.toString())&&!l(this,b)}function y(a){if(!a)return{};var b=a.type,c=a.target||a.srcElement;a.preventDefault=a.preventDefault||y.preventDefault,a.stopPropagation=a.stopPropagation||y.stopPropagation,a.target=c&&c.nodeType==3?c.parentNode:c;if(b.indexOf("key")!=-1)a.keyCode=a.which||a.keyCode;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;e.test(b)&&(a.relatedTarget=a.relatedTarget||a[(b=="mouseover"?"from":"to")+"Element"])}return a}function x(a,b,c){var d=m(b),e,f;e=c?d[c]:d;for(f in e)e.hasOwnProperty(f)&&(c?u:x)(a,c||b,c?e[f]:f);return a}function w(b,c){var d,e,j,k=c.split(" ");for(j=k.length;j--;){c=k[j].replace(g,"");var l=z.indexOf(c)>-1,n=k[j].replace(f,""),o=m(b)[c];if(n){n=n.split(".");for(e=n.length;e--;)o[n[e]]&&o[n[e]]()}else if(b[h])d=document.createEvent(l?"HTMLEvents":"UIEvents"),d[l?"initEvent":"initUIEvent"](c,!0,!0,a,1),b.dispatchEvent(d);else if(b[i])l?b.fireEvent("on"+c,document.createEventObject()):b["_on"+c]++;else for(e in o)o.hasOwnProperty(e)&&o[e]()}return b}function v(a,b,c){var d,e,h,i=typeof b=="string",j=i&&b.replace(f,""),k=s,l=m(a);if(i&&/\s/.test(b)){b=b.split(" ");var n=b.length-1;while(v(a,b[n])&&n--);return a}h=i?b.replace(g,""):b;if(!l||i&&!l[h])return a;if(typeof c=="function")k(a,h,c);else if(j)k(a,b);else{k=h?k:v,e=i&&h,h=h?c||l[h]||h:l;for(d in h)h.hasOwnProperty(d)&&k(a,e||d,h[d])}return a}function u(a,b,c,d,e){if(typeof b=="object"&&!c)for(var f in b)b.hasOwnProperty(f)&&u(a,f,b[f]);else{var g=typeof c=="string",h=(g?c:b).split(" ");c=g?t(b,d,e):c;for(var i=h.length;i--;)r(a,h[i],c,Array.prototype.slice.call(arguments,g?4:3))}return a}function t(a,b,c){return function(d){var e=typeof a=="string"?c(a,this):a;for(var f=d.target;f&&f!=this;f=f.parentNode)for(var g=e.length;g--;)if(e[g]==f)return b.apply(f,arguments)}}function s(a,b,c){var d,e,i,j,k=m(a),l=b.replace(g,"");if(!k||!k[l])return a;e=b.replace(f,""),i=e?e.split("."):[c.__uid];for(j=i.length;j--;){d=i[j],c=k[l][d],delete k[l][d],l=B[l]?B[l].base:l;var n=a[h]||z.indexOf(l)>-1;o(a,n?l:"propertychange",c,!1,!n&&l)}return a}function r(b,c,e,i){var j=c.replace(g,""),k=m(b),l=k[j]||(k[j]={}),r=n(e,c.replace(f,""));if(l[r])return b;var t=B[j];e=t&&t.condition?q(b,e,j,t.condition):e,j=t&&t.base||j;var u=a[h]||z.indexOf(j)>-1;e=u?p(b,e,i):q(b,e,j,!1,i);if(j=="unload"){var v=e;e=function(){s(b,j,e)&&v()}}o(b,u?j:"propertychange",e,!0,!u&&!0),l[r]=e,e.__uid=r;return j=="unload"?b:d[n(b)]=b}function q(a,b,c,d,e){return function(f){(d?d.call(this,f):f&&f.propertyName=="_on"+c||!f)&&b.apply(a,[f].concat(e))}}function p(b,c,d){return function(e){e=y(e||((this.ownerDocument||this.document||this).parentWindow||a).event);return c.apply(b,[e].concat(d))}}function o(a,b,c,d,e){a[h]?a[d?h:j](b,c,!1):a[i]&&(e&&d&&(a["_on"+e]=a["_on"+e]||0),a[d?i:k]("on"+b,c))}function n(a,c){return a.__uid=c||a.__uid||b++}function m(a){var b=n(a);return c[b]=c[b]||{}}function l(a,b){var c=b.parentNode;while(c!=null){if(c==a)return!0;c=c.parentNode}}var b=1,c={},d={},e=/over|out/,f=/[^\.]*(?=\..*)\.|.*/,g=/\..*/,h="addEventListener",i="attachEvent",j="removeEventListener",k="detachEvent";y.preventDefault=function(){this.returnValue=!1},y.stopPropagation=function(){this.cancelBubble=!0};var z="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".split(","),B={mouseenter:{base:"mouseover",condition:A},mouseleave:{base:"mouseout",condition:A},mousewheel:{base:/Firefox/.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel"}},C={add:u,remove:v,clone:x,fire:w},D=function(a){var b=v(a).__uid;b&&(delete d[b],delete c[b])};a[i]&&u(a,"unload",function(){for(var b in d)d.hasOwnProperty(b)&&D(d[b]);a.CollectGarbage&&CollectGarbage()});var E=a.bean;C.noConflict=function(){a.bean=E;return this},typeof module!="undefined"&&module.exports?module.exports=C:a.bean=C}(this)
!function(a){function F(a){var b=a.relatedTarget;if(!b)return b==null;return b!=this&&b.prefix!="xul"&&!/document/.test(this.toString())&&!p(this,b)}var b=1,c={},d={},e=/over|out/,f=/[^\.]*(?=\..*)\.|.*/,g=/\..*/,h="addEventListener",i="attachEvent",j="removeEventListener",k="detachEvent",l=a.document||{},m=l.documentElement||{},n=m[h],o=n?h:i,p=function(a,b){var c=b.parentNode;while(c!=null){if(c==a)return!0;c=c.parentNode}},q=function(a,c){return a.__uid=c||a.__uid||b++},r=function(a){var b=q(a);return c[b]=c[b]||{}},s=n?function(a,b,c,d){a[d?h:j](b,c,!1)}:function(a,b,c,d,e){e&&d&&(a["_on"+e]=a["_on"+e]||0),a[d?i:k]("on"+b,c)},t=function(b,c,d){return function(e){e=D(e||((this.ownerDocument||this.document||this).parentWindow||a).event);return c.apply(b,[e].concat(d))}},u=function(a,b,c,d,e){return function(f){(d?d.call(this,f):f&&f.propertyName=="_on"+c||!f)&&b.apply(a,[f].concat(e))}},v=function(a,b,c,e){var h=b.replace(g,""),i=r(a),j=i[h]||(i[h]={}),k=q(c,b.replace(f,""));if(j[k])return a;var l=G[h];l&&(c=l.condition?u(a,c,h,l.condition):c,h=l.base||h);var m=n||E.indexOf(h)>-1;c=m?t(a,c,e):u(a,c,h,!1,e);if(h=="unload"){var p=c;c=function(){w(a,h,c)&&p()}}a[o]&&s(a,m?h:"propertychange",c,!0,!m&&h),j[k]=c,c.__uid=k;return h=="unload"?a:d[q(a)]=a},w=function(a,b,c){var d,e,i,j,k=r(a),l=b.replace(g,"");if(!k||!k[l])return a;e=b.replace(f,""),i=e?e.split("."):[c.__uid];for(j=i.length;j--;){d=i[j],c=k[l][d],delete k[l][d];if(a[o]){l=G[l]?G[l].base:l;var m=a[h]||E.indexOf(l)>-1;s(a,m?l:"propertychange",c,!1,!m&&l)}}return a},x=function(a,b,c){return function(d){var e=typeof a=="string"?c(a,this):a;for(var f=d.target;f&&f!=this;f=f.parentNode)for(var g=e.length;g--;)if(e[g]==f)return b.apply(f,arguments)}},y=function(a,b,c,d,e){if(typeof b=="object"&&!c)for(var f in b)b.hasOwnProperty(f)&&y(a,f,b[f]);else{var g=typeof c=="string",h=(g?c:b).split(" ");c=g?x(b,d,e):c;for(var i=h.length;i--;)v(a,h[i],c,Array.prototype.slice.call(arguments,g?4:3))}return a},z=function(a,b,c){var d,e,h,i=typeof b=="string",j=i&&b.replace(f,""),k=w,l=r(a);if(i&&/\s/.test(b)){b=b.split(" ");var m=b.length-1;while(z(a,b[m])&&m--);return a}h=i?b.replace(g,""):b;if(!l||i&&!l[h])return a;if(typeof c=="function")k(a,h,c);else if(j)k(a,b);else{k=h?k:z,e=i&&h,h=h?c||l[h]||h:l;for(d in h)h.hasOwnProperty(d)&&k(a,e||d,h[d])}return a},A=function(a,b){var c,d,e,h=b.split(" ");for(e=h.length;e--;){b=h[e].replace(g,"");var i=E.indexOf(b)>-1,j=h[e].replace(f,""),k=r(a)[b];if(j){j=j.split(".");for(d=j.length;d--;)k[j[d]]&&k[j[d]]()}else if(a[o])B(i,b,a);else for(d in k)k.hasOwnProperty(d)&&k[d]()}return a},B=n?function(b,c,d){evt=document.createEvent(b?"HTMLEvents":"UIEvents"),evt[b?"initEvent":"initUIEvent"](c,!0,!0,a,1),d.dispatchEvent(evt)}:function(a,b,c){a?c.fireEvent("on"+b,document.createEventObject()):c["_on"+b]++},C=function(a,b,c){var d=r(b),e,f;e=c?d[c]:d;for(f in e)e.hasOwnProperty(f)&&(c?y:C)(a,c||b,c?e[f]:f);return a},D=function(a){var b={};if(!a)return b;var c=a.type,d=a.target||a.srcElement;b.preventDefault=D.preventDefault(a),b.stopPropagation=D.stopPropagation(a),b.target=d&&d.nodeType==3?d.parentNode:d;if(c.indexOf("key")!=-1)b.keyCode=a.which||a.keyCode;else if(/click|mouse|menu/i.test(c)){b.rightClick=a.which==3||a.button==2,b.pos={x:0,y:0};if(a.pageX||a.pageY)b.clientX=a.pageX,b.clientY=a.pageY;else if(a.clientX||a.clientY)b.clientX=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,b.clientY=a.clientY+document.body.scrollTop+document.documentElement.scrollTop;e.test(c)&&(b.relatedTarget=a.relatedTarget||a[(c=="mouseover"?"from":"to")+"Element"])}for(var f in a)f in b||(b[f]=a[f]);return b};D.preventDefault=function(a){return function(){a.preventDefault?a.preventDefault():a.returnValue=!1}},D.stopPropagation=function(a){return function(){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}};var E="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".split(","),G={mouseenter:{base:"mouseover",condition:F},mouseleave:{base:"mouseout",condition:F},mousewheel:{base:/Firefox/.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel"}},H={add:y,remove:z,clone:C,fire:A},I=function(a){var b=z(a).__uid;b&&(delete d[b],delete c[b])};a[i]&&y(a,"unload",function(){for(var b in d)d.hasOwnProperty(b)&&I(d[b]);a.CollectGarbage&&CollectGarbage()});var J=a.bean;H.noConflict=function(){a.bean=J;return this},typeof module!="undefined"&&module.exports?module.exports=H:a.bean=H}(this)
/*!
* Ender.js: next-level JavaScript
* Ender: open module JavaScript framework
* copyright Dustin Diaz & Jacob Thornton 2011 (@ded @fat)
* https://github.com/ded/Ender.js
* https://github.com/ender-js/ender
* License MIT
* Build: ender -j domready bean qwery
*/

@@ -11,3 +12,3 @@ !function (context) {

for (var k in o2) {
o[k] = o2[k];
k != 'noConflict' && (o[k] = o2[k]);
}

@@ -17,3 +18,3 @@ }

function _$(s, r) {
this.elements = $._select(s, r);
this.elements = typeof s !== 'string' && !s.nodeType && typeof s.length !== 'undefined' ? s : $._select(s, r);
this.length = this.elements.length;

@@ -48,318 +49,435 @@ for (var i = 0; i < this.length; i++) {

}(this);/*!
* bonzo.js - copyright @dedfat 2011
* https://github.com/ded/bonzo
* Follow our software http://twitter.com/dedfat
* MIT License
*/
!function (context) {
}(this);
!function () { var module = { exports: {} }; !function (doc) {
var loaded = 0, fns = [], ol, f = false,
testEl = doc.createElement('a'),
domContentLoaded = 'DOMContentLoaded',
addEventListener = 'addEventListener',
onreadystatechange = 'onreadystatechange';
var doc = document,
html = (doc.compatMode == 'CSS1Compat') ?
doc.documentElement :
doc.body,
specialAttributes = /^checked|value|selected$/,
stateAttributes = /^checked|selected$/,
ie = /msie/.test(navigator.userAgent);
/^loade|c/.test(doc.readyState) && (loaded = 1);
function classReg(c) {
return new RegExp("(^|\\s+)" + c + "(\\s+|$)");
function flush() {
loaded = 1;
for (var i = 0, l = fns.length; i < l; i++) {
fns[i]();
}
}
doc[addEventListener] && doc[addEventListener](domContentLoaded, function fn() {
doc.removeEventListener(domContentLoaded, fn, f);
flush();
}, f);
function each(ar, fn) {
for (i = 0, len = ar.length; i < len; i++) {
fn(ar[i]);
testEl.doScroll && doc.attachEvent(onreadystatechange, (ol = function ol() {
if (/^c/.test(doc.readyState)) {
doc.detachEvent(onreadystatechange, ol);
flush();
}
}
}));
function trim(s) {
return s.replace(/(^\s*|\s*$)/g, '');
}
var domReady = testEl.doScroll ?
function (fn) {
self != top ?
!loaded ?
fns.push(fn) :
fn() :
!function () {
try {
testEl.doScroll('left');
} catch (e) {
return setTimeout(function() {
domReady(fn);
}, 50);
}
fn();
}();
} :
function (fn) {
loaded ? fn() : fns.push(fn);
};
function camelize(s) {
return s.replace(/-(.)/g, function (m, m1) {
return m1.toUpperCase();
});
}
(typeof module !== 'undefined') && module.exports ?
(module.exports = {domReady: domReady}) :
(window.domReady = domReady);
function is(node) {
return node && node.nodeName && node.nodeType == 1;
}
}(document); $.ender(module.exports); }();
/*!
* bean.js - copyright @dedfat
* https://github.com/fat/bean
* Follow our software http://twitter.com/dedfat
* MIT License
* special thanks to:
* dean edwards: http://dean.edwards.name/
* dperini: https://github.com/dperini/nwevents
* the entire mootools team: github.com/mootools/mootools-core
*/
!function (context) {
var __uid = 1, registry = {}, collected = {},
overOut = /over|out/,
namespace = /[^\.]*(?=\..*)\.|.*/,
stripName = /\..*/,
addEvent = 'addEventListener',
attachEvent = 'attachEvent',
removeEvent = 'removeEventListener',
detachEvent = 'detachEvent',
doc = context.document || {},
root = doc.documentElement || {},
W3C_MODEL = root[addEvent],
eventSupport = W3C_MODEL ? addEvent : attachEvent,
function some(ar, fn, scope) {
for (var i = 0, j = ar.length; i < j; ++i) {
if (fn.call(scope, ar[i], i, ar)) {
isDescendant = function (parent, child) {
var node = child.parentNode;
while (node != null) {
if (node == parent) {
return true;
}
node = node.parentNode;
}
return false;
}
},
function _bonzo(elements) {
this.elements = elements && Object.prototype.hasOwnProperty.call(elements, 'length') ? elements : [elements];
}
retrieveUid = function (obj, uid) {
return (obj.__uid = uid || obj.__uid || __uid++);
},
_bonzo.prototype = {
retrieveEvents = function (element) {
var uid = retrieveUid(element);
return (registry[uid] = registry[uid] || {});
},
each: function (fn) {
for (var i = 0; i < this.elements.length; i++) {
fn.call(this, this.elements[i]);
listener = W3C_MODEL ? function (element, type, fn, add) {
element[add ? addEvent : removeEvent](type, fn, false);
} : function (element, type, fn, add, custom) {
custom && add && (element['_on' + custom] = element['_on' + custom] || 0);
element[add ? attachEvent : detachEvent]('on' + type, fn);
},
nativeHandler = function (element, fn, args) {
return function (event) {
event = fixEvent(event || ((this.ownerDocument || this.document || this).parentWindow || context).event);
return fn.apply(element, [event].concat(args));
};
},
customHandler = function (element, fn, type, condition, args) {
return function (event) {
if (condition ? condition.call(this, event) : event && event.propertyName == '_on' + type || !event) {
fn.apply(element, [event].concat(args));
}
return this;
},
};
},
map: function (fn) {
var m = [];
for (var i = 0; i < this.elements.length; i++) {
m.push(fn.call(this, this.elements[i]));
addListener = function (element, orgType, fn, args) {
var type = orgType.replace(stripName, ''),
events = retrieveEvents(element),
handlers = events[type] || (events[type] = {}),
uid = retrieveUid(fn, orgType.replace(namespace, ''));
if (handlers[uid]) {
return element;
}
var custom = customEvents[type];
if (custom) {
fn = custom.condition ? customHandler(element, fn, type, custom.condition) : fn;
type = custom.base || type;
}
var isNative = W3C_MODEL || nativeEvents.indexOf(type) > -1;
fn = isNative ? nativeHandler(element, fn, args) : customHandler(element, fn, type, false, args);
if (type == 'unload') {
var org = fn;
fn = function () {
removeListener(element, type, fn) && org();
};
}
element[eventSupport] && listener(element, isNative ? type : 'propertychange', fn, true, !isNative && type);
handlers[uid] = fn;
fn.__uid = uid;
return type == 'unload' ? element : (collected[retrieveUid(element)] = element);
},
removeListener = function (element, orgType, handler) {
var uid, names, uids, i, events = retrieveEvents(element), type = orgType.replace(stripName, '');
if (!events || !events[type]) {
return element;
}
names = orgType.replace(namespace, '');
uids = names ? names.split('.') : [handler.__uid];
for (i = uids.length; i--;) {
uid = uids[i];
handler = events[type][uid];
delete events[type][uid];
if (element[eventSupport]) {
type = customEvents[type] ? customEvents[type].base : type;
var isNative = element[addEvent] || nativeEvents.indexOf(type) > -1;
listener(element, isNative ? type : 'propertychange', handler, false, !isNative && type);
}
return m;
},
}
return element;
},
first: function () {
return this.elements[0];
},
del = function (selector, fn, $) {
return function (e) {
var array = typeof selector == 'string' ? $(selector, this) : selector;
for (var target = e.target; target && target != this; target = target.parentNode) {
for (var i = array.length; i--;) {
if (array[i] == target) {
return fn.apply(target, arguments);
}
}
}
};
},
last: function () {
return this.elements[this.elements.length - 1];
},
add = function (element, events, fn, delfn, $) {
if (typeof events == 'object' && !fn) {
for (var type in events) {
events.hasOwnProperty(type) && add(element, type, events[type]);
}
} else {
var isDel = typeof fn == 'string', types = (isDel ? fn : events).split(' ');
fn = isDel ? del(events, delfn, $) : fn;
for (var i = types.length; i--;) {
addListener(element, types[i], fn, Array.prototype.slice.call(arguments, isDel ? 4 : 3));
}
}
return element;
},
html: function (html) {
return typeof html == 'string' ?
this.each(function (el) {
el.innerHTML = html;
}) :
this.elements[0].innerHTML;
},
remove = function (element, orgEvents, fn) {
var k, type, events,
isString = typeof(orgEvents) == 'string',
names = isString && orgEvents.replace(namespace, ''),
rm = removeListener,
attached = retrieveEvents(element);
if (isString && /\s/.test(orgEvents)) {
orgEvents = orgEvents.split(' ');
var i = orgEvents.length - 1;
while (remove(element, orgEvents[i]) && i--) {}
return element;
}
events = isString ? orgEvents.replace(stripName, '') : orgEvents;
if (!attached || (isString && !attached[events])) {
return element;
}
if (typeof fn == 'function') {
rm(element, events, fn);
} else if (names) {
rm(element, orgEvents);
} else {
rm = events ? rm : remove;
type = isString && events;
events = events ? (fn || attached[events] || events) : attached;
for (k in events) {
events.hasOwnProperty(k) && rm(element, type || k, events[k]);
}
}
return element;
},
addClass: function (c) {
return this.each(function (el) {
this.hasClass(el, c) || (el.className = trim(el.className + ' ' + c));
});
},
fire = function (element, type) {
var evt, k, i, types = type.split(' ');
for (i = types.length; i--;) {
type = types[i].replace(stripName, '');
var isNative = nativeEvents.indexOf(type) > -1,
isNamespace = types[i].replace(namespace, ''),
handlers = retrieveEvents(element)[type];
if (isNamespace) {
isNamespace = isNamespace.split('.');
for (k = isNamespace.length; k--;) {
handlers[isNamespace[k]] && handlers[isNamespace[k]]();
}
} else if (element[eventSupport]) {
fireListener(isNative, type, element);
} else {
for (k in handlers) {
handlers.hasOwnProperty(k) && handlers[k]();
}
}
}
return element;
},
removeClass: function (c) {
return this.each(function (el) {
this.hasClass(el, c) && (el.className = trim(el.className.replace(classReg(c), ' ')));
});
},
fireListener = W3C_MODEL ? function (isNative, type, element) {
evt = document.createEvent(isNative ? "HTMLEvents" : "UIEvents");
evt[isNative ? 'initEvent' : 'initUIEvent'](type, true, true, context, 1);
element.dispatchEvent(evt);
} : function (isNative, type, element) {
isNative ? element.fireEvent('on' + type, document.createEventObject()) : element['_on' + type]++;
},
hasClass: function (el, c) {
return typeof c == 'undefined' ?
some(this.elements, function (i) {
return classReg(el).test(i.className);
}) :
classReg(c).test(el.className);
},
clone = function (element, from, type) {
var events = retrieveEvents(from), obj, k;
obj = type ? events[type] : events;
for (k in obj) {
obj.hasOwnProperty(k) && (type ? add : clone)(element, type || from, type ? obj[k] : k);
}
return element;
},
show: function (elements) {
return this.each(function (el) {
el.style.display = '';
});
},
fixEvent = function (e) {
var result = {};
if (!e) {
return result;
}
var type = e.type, target = e.target || e.srcElement;
result.preventDefault = fixEvent.preventDefault(e);
result.stopPropagation = fixEvent.stopPropagation(e);
result.target = target && target.nodeType == 3 ? target.parentNode : target;
if (type.indexOf('key') != -1) {
result.keyCode = e.which || e.keyCode;
} else if ((/click|mouse|menu/i).test(type)) {
result.rightClick = e.which == 3 || e.button == 2;
result.pos = { x: 0, y: 0 };
if (e.pageX || e.pageY) {
result.clientX = e.pageX;
result.clientY = e.pageY;
} else if (e.clientX || e.clientY) {
result.clientX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
result.clientY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
}
overOut.test(type) && (result.relatedTarget = e.relatedTarget || e[(type == 'mouseover' ? 'from' : 'to') + 'Element']);
}
for (var k in e) {
if (!(k in result)) {
result[k] = e[k];
}
}
return result;
};
hide: function (elements) {
return this.each(function (el) {
el.style.display = 'none';
});
},
fixEvent.preventDefault = function (e) {
return function () {
if (e.preventDefault) {
e.preventDefault();
}
else {
e.returnValue = false;
}
};
};
create: function (node) {
return typeof node == 'string' ?
function () {
var el = doc.createElement('div'), els = [];
el.innerHTML = node;
var nodes = el.childNodes;
el = el.firstChild;
els.push(el);
while (el = el.nextSibling) {
(el.nodeType == 1) && els.push(el);
}
return els;
fixEvent.stopPropagation = function (e) {
return function () {
if (e.stopPropagation) {
e.stopPropagation();
} else {
e.cancelBubble = true;
}
};
};
}() : is(node) ? [node.cloneNode(true)] : [];
},
var nativeEvents = 'click,dblclick,mouseup,mousedown,contextmenu,' + //mouse buttons
'mousewheel,DOMMouseScroll,' + //mouse wheel
'mouseover,mouseout,mousemove,selectstart,selectend,' + //mouse movement
'keydown,keypress,keyup,' + //keyboard
'orientationchange,' + // mobile
'touchstart,touchmove,touchend,touchcancel,' + // touch
'gesturestart,gesturechange,gestureend,' + // gesture
'focus,blur,change,reset,select,submit,' + //form elements
'load,unload,beforeunload,resize,move,DOMContentLoaded,readystatechange,' + //window
'error,abort,scroll'.split(','); //misc
append: function (node) {
return this.each(function (el) {
each(this.create(node), function (i) {
el.appendChild(i);
});
});
},
function check(event) {
var related = event.relatedTarget;
if (!related) {
return related == null;
}
return (related != this && related.prefix != 'xul' && !/document/.test(this.toString()) && !isDescendant(this, related));
}
prepend: function (node) {
return this.each(function (el) {
var first = el.firstChild;
each(this.create(node), function (i) {
el.insertBefore(i, first);
});
});
},
var customEvents = {
mouseenter: { base: 'mouseover', condition: check },
mouseleave: { base: 'mouseout', condition: check },
mousewheel: { base: /Firefox/.test(navigator.userAgent) ? 'DOMMouseScroll' : 'mousewheel' }
};
before: function (node) {
return this.each(function (el) {
each(this.create(node), function (i) {
el.parentNode.insertBefore(i, el);
});
});
},
var bean = { add: add, remove: remove, clone: clone, fire: fire };
after: function (node) {
return this.each(function (el) {
each(this.create(node), function (i) {
el.parentNode.insertBefore(i, el.nextSibling);
});
});
},
var clean = function (el) {
var uid = remove(el).__uid;
if (uid) {
delete collected[uid];
delete registry[uid];
}
};
css: function (o, v) {
var fn = typeof o == 'string' ?
function (el) {
el.style[camelize(o)] = v;
} :
function (el) {
for (var k in o) {
o.hasOwnProperty(k) && (el.style[camelize(k)] = o[k]);
}
};
return this.each(fn);
},
offset: function () {
var el = this.first();
var width = el.offsetWidth;
var height = el.offsetHeight;
var top = el.offsetTop;
var left = el.offsetLeft;
while (el = el.offsetParent) {
top = top + el.offsetTop;
left = left + el.offsetLeft;
if (context[attachEvent]) {
add(context, 'unload', function () {
for (var k in collected) {
collected.hasOwnProperty(k) && clean(collected[k]);
}
context.CollectGarbage && CollectGarbage();
});
}
return {
top: top,
left: left,
height: height,
width: width
};
},
var oldBean = context.bean;
bean.noConflict = function () {
context.bean = oldBean;
return this;
};
attr: function (k, v) {
var el = this.first();
return typeof v == 'undefined' ?
specialAttributes.test(k) ?
stateAttributes.test(k) && typeof el[k] == 'string' ?
true : el[k] : el.getAttribute(k) :
this.each(function (el) {
el.setAttribute(k, v);
});
},
(typeof module !== 'undefined' && module.exports) ?
(module.exports = bean) :
(context.bean = bean);
remove: function () {
return this.each(function (el) {
el.parentNode.removeChild(el);
});
},
}(this);!function () {
var b = bean.noConflict(),
integrate = function (method, type, method2) {
var _args = type ? [type] : [];
return function () {
for (var args, i = 0, l = this.elements.length; i < l; i++) {
args = [this.elements[i]].concat(_args, Array.prototype.slice.call(arguments, 0));
args.length == 4 && args.push($);
!arguments.length && method == 'add' && type && (method = 'fire');
b[method].apply(this, args);
}
return this;
};
};
empty: function () {
return this.each(function (el) {
while (el.firstChild) {
el.removeChild(el.firstChild);
}
});
},
var add = integrate('add'),
remove = integrate('remove'),
fire = integrate('fire');
detach: function () {
return this.map(function (el) {
return el.parentNode.removeChild(el);
});
},
var methods = {
scrollTop: function (y) {
return scroll.call(this, null, y, 'y');
},
on: add,
addListener: add,
bind: add,
listen: add,
delegate: add,
scrollLeft: function (x) {
return scroll.call(this, x, null, 'x');
}
unbind: remove,
unlisten: remove,
removeListener: remove,
undelegate: remove,
};
emit: fire,
trigger: fire,
function scroll(x, y, type) {
var el = this.first();
if (x == null && y == null) {
return (isBody(el) ? getWindowScroll() : { x: el.scrollLeft, y: el.scrollTop })[type];
}
if (isBody(el)) {
window.scrollTo(x, y);
} else {
x != null && (el.scrollLeft = x);
y != null && (el.scrollTop = y);
}
return this;
}
cloneEvents: integrate('clone'),
function isBody(element) {
return element === window || (/^(?:body|html)$/i).test(element.tagName);
}
function getWindowScroll() {
return { x: window.pageXOffset || html.scrollLeft, y: window.pageYOffset || html.scrollTop };
}
function bonzo(els) {
return new _bonzo(els);
}
bonzo.aug = function (o, target) {
for (var k in o) {
o.hasOwnProperty(k) && ((target || _bonzo.prototype)[k] = o[k]);
hover: function (enter, leave) {
for (var i = 0, l = this.elements.length; i < l; i++) {
b.add.call(this, this.elements[i], 'mouseenter', enter);
b.add.call(this, this.elements[i], 'mouseleave', leave);
}
return this;
}
};
bonzo.doc = function () {
var w = html.scrollWidth,
h = html.scrollHeight,
vp = this.viewport();
return {
width: Math.max(w, vp.width),
height: Math.max(h, vp.height)
};
};
var shortcuts = [
'blur', 'change', 'click', 'dbltclick', 'error', 'focus', 'focusin',
'focusout', 'keydown', 'keypress', 'keyup', 'load', 'mousedown',
'mouseenter', 'mouseleave', 'mouseout', 'mouseover', 'mouseup',
'resize', 'scroll', 'select', 'submit', 'unload'
];
bonzo.viewport = function () {
var h = self.innerHeight,
w = self.innerWidth;
ie && (h = html.clientHeight) && (w = html.clientWidth);
return {
width: w,
height: h
};
};
for (var i = shortcuts.length; i--;) {
var shortcut = shortcuts[i];
methods[shortcut] = integrate('add', shortcut);
}
bonzo.contains = 'compareDocumentPosition' in html ?
function (container, element) {
return (container.compareDocumentPosition(element) & 16) == 16;
} : 'contains' in html ?
function (container, element) {
return container !== element && container.contains(element);
} :
function (container, element) {
while (element = element.parentNode) {
if (element === container) {
return true;
}
}
return false;
};
var old = context.bonzo;
bonzo.noConflict = function () {
context.bonzo = old;
return this;
};
context.bonzo = bonzo;
}(this);/*!
$.ender(methods, true);
}();
/*!
* qwery.js - copyright @dedfat

@@ -529,3 +647,10 @@ * https://github.com/ded/qwery

function boilerPlate(selector, root) {
function boilerPlate(selector, _root, fn) {
var root = (typeof _root == 'string') ? fn(_root)[0] : (_root || doc);
if (isNode(selector)) {
return !_root || (isNode(root) && isAncestor(selector, root)) ? [selector] : [];
}
if (selector && typeof selector === 'object' && selector.length && isFinite(selector.length)) {
return array(selector);
}
if (m = selector.match(idOnly)) {

@@ -546,9 +671,6 @@ return (el = doc.getElementById(m[1])) ? [el] : [];

var root = (typeof _root == 'string') ? qsa(_root)[0] : (_root || doc);
if (isNode(selector)) {
return !_root || isAncestor(selector, root) ? [selector] : [];
}
if (!root) {
return [];
}
if (m = boilerPlate(selector, root)) {
if (m = boilerPlate(selector, _root, qsa)) {
return m;

@@ -583,5 +705,2 @@ }

var root = (typeof _root == 'string') ? qwery(_root)[0] : (_root || doc);
if (isNode(selector)) {
return !_root || isAncestor(selector, root) ? [selector] : [];
}
if (!root) {

@@ -591,3 +710,3 @@ return [];

var i, l, result = [], collections = [], element;
if (m = boilerPlate(selector, root)) {
if (m = boilerPlate(selector, _root, qwery)) {
return m;

@@ -621,3 +740,3 @@ }

// being nice
qwery.uniq = uniq;
var oldQwery = context.qwery;

@@ -631,161 +750,17 @@ qwery.noConflict = function () {

}(this, document);
/*!
* $script.js v1.3
* https://github.com/ded/script.js
* Copyright: @ded & @fat - Dustin Diaz, Jacob Thornton 2011
* Follow our software http://twitter.com/dedfat
* License: MIT
*/
/*!
* $script.js v1.3
* https://github.com/ded/script.js
* Copyright: @ded & @fat - Dustin Diaz, Jacob Thornton 2011
* Follow our software http://twitter.com/dedfat
* License: MIT
*/
!function(win, doc, timeout) {
var script = doc.getElementsByTagName("script")[0],
list = {}, ids = {}, delay = {}, re = /^i|c/, loaded = 0, fns = [], ol,
scripts = {}, s = 'string', f = false, i, testEl = doc.createElement('a'),
push = 'push', domContentLoaded = 'DOMContentLoaded', readyState = 'readyState',
addEventListener = 'addEventListener', onreadystatechange = 'onreadystatechange',
every = function(ar, fn) {
for (i = 0, j = ar.length; i < j; ++i) {
if (!fn(ar[i])) {
return 0;
}
!function () {
var q = qwery.noConflict();
$._select = q;
$.ender({
find: function (s) {
var r = [], i, l, j, k, els;
for (i = 0, l = this.length; i < l; i++) {
els = q(s, this[i]);
for (j = 0, k = els.length; j < k; j++) {
r.push(els[j]);
}
return 1;
};
function each(ar, fn) {
every(ar, function(el) {
return !fn(el);
});
}
if (!doc[readyState] && doc[addEventListener]) {
doc[addEventListener](domContentLoaded, function fn() {
doc.removeEventListener(domContentLoaded, fn, f);
doc[readyState] = "complete";
}, f);
doc[readyState] = "loading";
}
var $script = function(paths, idOrDone, optDone) {
paths = paths[push] ? paths : [paths];
var idOrDoneIsDone = idOrDone && idOrDone.call,
done = idOrDoneIsDone ? idOrDone : optDone,
id = idOrDoneIsDone ? paths.join('') : idOrDone,
queue = paths.length;
function loopFn(item) {
return item.call ? item() : list[item];
}
function callback() {
if (!--queue) {
list[id] = 1;
done && done();
for (var dset in delay) {
every(dset.split('|'), loopFn) && !each(delay[dset], loopFn) && (delay[dset] = []);
}
}
}
if (id && ids[id]) {
return;
return $(q.uniq(r));
}
timeout(function() {
each(paths, function(path) {
if (scripts[path]) {
return;
}
scripts[path] = 1;
id && (ids[id] = 1);
var el = doc.createElement("script"),
loaded = 0;
el.onload = el[onreadystatechange] = function () {
if ((el[readyState] && !(!re.test(el[readyState]))) || loaded) {
return;
}
el.onload = el[onreadystatechange] = null;
loaded = 1;
callback();
};
el.async = 1;
el.src = path;
script.parentNode.insertBefore(el, script);
});
}, 0);
return $script;
};
$script.ready = function(deps, ready, req) {
deps = deps[push] ? deps : [deps];
var missing = [];
!each(deps, function(dep) {
list[dep] || missing[push](dep);
}) && every(deps, function(dep) {
return list[dep];
}) ? ready() : !function(key) {
delay[key] = delay[key] || [];
delay[key][push](ready);
req && req(missing);
}(deps.join('|'));
return $script;
};
function again(fn) {
timeout(function() {
domReady(fn);
}, 50);
}
testEl.doScroll && doc.attachEvent(onreadystatechange, (ol = function ol() {
/^c/.test(doc[readyState]) &&
(loaded = 1) &&
!doc.detachEvent(onreadystatechange, ol) &&
each(fns, function (f) {
f();
});
}));
var domReady = testEl.doScroll ?
function (fn) {
self != top ?
!loaded ?
fns[push](fn) :
fn() :
!function () {
try {
testEl.doScroll('left');
} catch (e) {
return again(fn);
}
fn();
}();
} :
function (fn) {
re.test(doc[readyState]) ? fn() : again(fn);
};
$script.domReady = domReady;
var old = win.$script;
$script.noConflict = function () {
win.$script = old;
return this;
};
(typeof module !== 'undefined' && module.exports) ?
(module.exports = $script) :
(win.$script = $script);
}(this, document, setTimeout);$.ender(bonzo);
$.ender(bonzo(), true);
bonzo.noConflict();$._select = qwery.noConflict();!function () {
var s = $script.noConflict();
$.ender({
script: s,
domReady: s.domReady
});
}, true);
}();
{
"name": "bean",
"description": "an events api for javascript",
"version": "0.0.35",
"version": "0.1.0",
"homepage": "https://github.com/fat/bean",

@@ -6,0 +6,0 @@ "authors": ["Jacob Thornton <@fat>"],

@@ -9,5 +9,9 @@ !function (context) {

removeEvent = 'removeEventListener',
detachEvent = 'detachEvent';
detachEvent = 'detachEvent',
doc = context.document || {},
root = doc.documentElement || {},
W3C_MODEL = root[addEvent],
eventSupport = W3C_MODEL ? addEvent : attachEvent,
function isDescendant(parent, child) {
isDescendant = function (parent, child) {
var node = child.parentNode;

@@ -20,23 +24,21 @@ while (node != null) {

}
}
},
function retrieveEvents(element) {
retrieveUid = function (obj, uid) {
return (obj.__uid = uid || obj.__uid || __uid++);
},
retrieveEvents = function (element) {
var uid = retrieveUid(element);
return (registry[uid] = registry[uid] || {});
}
},
function retrieveUid(obj, uid) {
return (obj.__uid = uid || obj.__uid || __uid++);
}
listener = W3C_MODEL ? function (element, type, fn, add) {
element[add ? addEvent : removeEvent](type, fn, false);
} : function (element, type, fn, add, custom) {
custom && add && (element['_on' + custom] = element['_on' + custom] || 0);
element[add ? attachEvent : detachEvent]('on' + type, fn);
},
function listener(element, type, fn, add, custom) {
if (element[addEvent]) {
element[add ? addEvent : removeEvent](type, fn, false);
} else if (element[attachEvent]) {
custom && add && (element['_on' + custom] = element['_on' + custom] || 0);
element[add ? attachEvent : detachEvent]('on' + type, fn);
}
}
function nativeHandler(element, fn, args) {
nativeHandler = function (element, fn, args) {
return function (event) {

@@ -46,5 +48,5 @@ event = fixEvent(event || ((this.ownerDocument || this.document || this).parentWindow || context).event);

};
}
},
function customHandler(element, fn, type, condition, args) {
customHandler = function (element, fn, type, condition, args) {
return function (event) {

@@ -55,6 +57,7 @@ if (condition ? condition.call(this, event) : event && event.propertyName == '_on' + type || !event) {

};
}
},
function addListener(element, orgType, fn, args) {
var type = orgType.replace(stripName, ''), events = retrieveEvents(element),
addListener = function (element, orgType, fn, args) {
var type = orgType.replace(stripName, ''),
events = retrieveEvents(element),
handlers = events[type] || (events[type] = {}),

@@ -66,5 +69,7 @@ uid = retrieveUid(fn, orgType.replace(namespace, ''));

var custom = customEvents[type];
fn = custom && custom.condition ? customHandler(element, fn, type, custom.condition) : fn;
type = custom && custom.base || type;
var isNative = context[addEvent] || nativeEvents.indexOf(type) > -1;
if (custom) {
fn = custom.condition ? customHandler(element, fn, type, custom.condition) : fn;
type = custom.base || type;
}
var isNative = W3C_MODEL || nativeEvents.indexOf(type) > -1;
fn = isNative ? nativeHandler(element, fn, args) : customHandler(element, fn, type, false, args);

@@ -77,9 +82,9 @@ if (type == 'unload') {

}
listener(element, isNative ? type : 'propertychange', fn, true, !isNative && true);
element[eventSupport] && listener(element, isNative ? type : 'propertychange', fn, true, !isNative && type);
handlers[uid] = fn;
fn.__uid = uid;
return type == 'unload' ? element : (collected[retrieveUid(element)] = element);
}
},
function removeListener(element, orgType, handler) {
removeListener = function (element, orgType, handler) {
var uid, names, uids, i, events = retrieveEvents(element), type = orgType.replace(stripName, '');

@@ -95,10 +100,12 @@ if (!events || !events[type]) {

delete events[type][uid];
type = customEvents[type] ? customEvents[type].base : type;
var isNative = element[addEvent] || nativeEvents.indexOf(type) > -1;
listener(element, isNative ? type : 'propertychange', handler, false, !isNative && type);
if (element[eventSupport]) {
type = customEvents[type] ? customEvents[type].base : type;
var isNative = element[addEvent] || nativeEvents.indexOf(type) > -1;
listener(element, isNative ? type : 'propertychange', handler, false, !isNative && type);
}
}
return element;
}
},
function del(selector, fn, $) {
del = function (selector, fn, $) {
return function (e) {

@@ -114,5 +121,5 @@ var array = typeof selector == 'string' ? $(selector, this) : selector;

};
}
},
function add(element, events, fn, delfn, $) {
add = function (element, events, fn, delfn, $) {
if (typeof events == 'object' && !fn) {

@@ -130,5 +137,5 @@ for (var type in events) {

return element;
}
},
function remove(element, orgEvents, fn) {
remove = function (element, orgEvents, fn) {
var k, type, events,

@@ -162,5 +169,5 @@ isString = typeof(orgEvents) == 'string',

return element;
}
},
function fire(element, type) {
fire = function (element, type) {
var evt, k, i, types = type.split(' ');

@@ -177,8 +184,4 @@ for (i = types.length; i--;) {

}
} else if (element[addEvent]) {
evt = document.createEvent(isNative ? "HTMLEvents" : "UIEvents");
evt[isNative ? 'initEvent' : 'initUIEvent'](type, true, true, context, 1);
element.dispatchEvent(evt);
} else if (element[attachEvent]) {
isNative ? element.fireEvent('on' + type, document.createEventObject()) : element['_on' + type]++;
} else if (element[eventSupport]) {
fireListener(isNative, type, element);
} else {

@@ -191,5 +194,13 @@ for (k in handlers) {

return element;
}
},
function clone(element, from, type) {
fireListener = W3C_MODEL ? function (isNative, type, element) {
evt = document.createEvent(isNative ? "HTMLEvents" : "UIEvents");
evt[isNative ? 'initEvent' : 'initUIEvent'](type, true, true, context, 1);
element.dispatchEvent(evt);
} : function (isNative, type, element) {
isNative ? element.fireEvent('on' + type, document.createEventObject()) : element['_on' + type]++;
},
clone = function (element, from, type) {
var events = retrieveEvents(from), obj, k;

@@ -201,35 +212,56 @@ obj = type ? events[type] : events;

return element;
}
},
function fixEvent(e) {
fixEvent = function (e) {
var result = {};
if (!e) {
return {};
return result;
}
var type = e.type, target = e.target || e.srcElement;
e.preventDefault = e.preventDefault || fixEvent.preventDefault;
e.stopPropagation = e.stopPropagation || fixEvent.stopPropagation;
e.target = target && target.nodeType == 3 ? target.parentNode : target;
result.preventDefault = fixEvent.preventDefault(e);
result.stopPropagation = fixEvent.stopPropagation(e);
result.target = target && target.nodeType == 3 ? target.parentNode : target;
if (type.indexOf('key') != -1) {
e.keyCode = e.which || e.keyCode;
result.keyCode = e.which || e.keyCode;
} else if ((/click|mouse|menu/i).test(type)) {
e.rightClick = e.which == 3 || e.button == 2;
e.pos = { x: 0, y: 0 };
result.rightClick = e.which == 3 || e.button == 2;
result.pos = { x: 0, y: 0 };
if (e.pageX || e.pageY) {
e.pos.x = e.pageX;
e.pos.y = e.pageY;
result.clientX = e.pageX;
result.clientY = e.pageY;
} else if (e.clientX || e.clientY) {
e.pos.x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
e.pos.y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
result.clientX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
result.clientY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
}
overOut.test(type) && (e.relatedTarget = e.relatedTarget || e[(type == 'mouseover' ? 'from' : 'to') + 'Element']);
overOut.test(type) && (result.relatedTarget = e.relatedTarget || e[(type == 'mouseover' ? 'from' : 'to') + 'Element']);
}
return e;
}
fixEvent.preventDefault = function () {
this.returnValue = false;
for (var k in e) {
if (!(k in result)) {
result[k] = e[k];
}
}
return result;
};
fixEvent.stopPropagation = function () {
this.cancelBubble = true;
fixEvent.preventDefault = function (e) {
return function () {
if (e.preventDefault) {
e.preventDefault();
}
else {
e.returnValue = false;
}
};
};
fixEvent.stopPropagation = function (e) {
return function () {
if (e.stopPropagation) {
e.stopPropagation();
} else {
e.cancelBubble = true;
}
};
};
var nativeEvents = 'click,dblclick,mouseup,mousedown,contextmenu,' + //mouse buttons

@@ -236,0 +268,0 @@ 'mousewheel,DOMMouseScroll,' + //mouse wheel

@@ -6,5 +6,6 @@ !function () {

return function () {
for (var args, i = 0, l = this.elements.length; i < l; i++) {
args = [this.elements[i]].concat(_args, Array.prototype.slice.call(arguments, 0));
for (var args, i = 0, l = this.length; i < l; i++) {
args = [this[i]].concat(_args, Array.prototype.slice.call(arguments, 0));
args.length == 4 && args.push($);
!arguments.length && method == 'add' && type && (method = 'fire');
b[method].apply(this, args);

@@ -17,17 +18,27 @@ }

var add = integrate('add'),
remove = integrate('remove');
remove = integrate('remove'),
fire = integrate('fire');
var methods = {
on: add,
addListener: add,
bind: add,
listen: add,
delegate: add,
undelegate: remove,
unbind: remove,
unlisten: remove,
trigger: integrate('fire'),
removeListener: remove,
undelegate: remove,
emit: fire,
trigger: fire,
cloneEvents: integrate('clone'),
hover: function (enter, leave) {
for (var i = 0, l = this.elements.length; i < l; i++) {
b.add.call(this, this.elements[i], 'mouseenter', enter);
b.add.call(this, this.elements[i], 'mouseleave', leave);
for (var i = 0, l = this.length; i < l; i++) {
b.add.call(this, this[i], 'mouseenter', enter);
b.add.call(this, this[i], 'mouseleave', leave);
}

@@ -39,3 +50,3 @@ return this;

var shortcuts = [
'blur', 'change', 'click', 'dbltclick', 'error', 'focus', 'focusin',
'blur', 'change', 'click', 'dblclick', 'error', 'focus', 'focusin',
'focusout', 'keydown', 'keypress', 'keyup', 'load', 'mousedown',

@@ -42,0 +53,0 @@ 'mouseenter', 'mouseleave', 'mouseout', 'mouseover', 'mouseup',

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc