Comparing version 1.0.0a1 to 1.0.0
13
bean.js
/*! | ||
* bean.js - copyright Jacob Thornton 2011 | ||
* Bean - copyright (c) Jacob Thornton 2011-2012 | ||
* https://github.com/fat/bean | ||
* 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 | ||
* MIT license | ||
*/ | ||
!(function (name, context, definition) { | ||
if (typeof module != 'undefined') module.exports = definition(name, context); | ||
if (typeof module != 'undefined' && module.exports) module.exports = definition(name, context); | ||
else if (typeof define == 'function' && typeof define.amd == 'object') define(definition); | ||
@@ -588,2 +584,3 @@ else context[name] = definition(name, context); | ||
//TODO: the undefined check means you can't pass an 'args' argument, fix this perhaps? | ||
if (selector === undefined && typeof events == 'object') { | ||
@@ -741,2 +738,2 @@ //TODO: this can't handle delegated events | ||
return bean | ||
})); | ||
})); |
/*! | ||
* bean.js - copyright Jacob Thornton 2011 | ||
* Bean - copyright (c) Jacob Thornton 2011-2012 | ||
* https://github.com/fat/bean | ||
* 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 | ||
* MIT license | ||
*/ | ||
!function(e,t,n){typeof module!="undefined"?module.exports=n(e,t):typeof define=="function"&&typeof define.amd=="object"?define(n):t[e]=n(e,t)}("bean",this,function(e,t){var n=window,r=t[e],i=/[^\.]*(?=\..*)\.|.*/,s=/\..*/,o="addEventListener",u="removeEventListener",a=document||{},f=a.documentElement||{},l=f[o],c=l?o:"attachEvent",h={},p=Array.prototype.slice,d=function(e,t){return e.split(t||" ")},v=function(e){return typeof e=="string"},m=function(e){return typeof e=="function"},g="click dblclick mouseup mousedown contextmenu mousewheel mousemultiwheel DOMMouseScroll mouseover mouseout mousemove selectstart selectend keydown keypress keyup orientationchange focus blur change reset select submit load unload beforeunload resize move DOMContentLoaded readystatechange message error abort scroll ",y="show input invalid touchstart touchmove touchend touchcancel gesturestart gesturechange gestureend textinputreadystatechange pageshow pagehide popstate hashchange offline online afterprint beforeprint dragstart dragenter dragover dragleave drag drop dragend loadstart progress suspend emptied stalled loadmetadata loadeddata canplay canplaythrough playing waiting seeking seeked ended durationchange timeupdate play pause ratechange volumechange cuechange checking noupdate downloading cached updateready obsolete ",b=function(e,t,n){for(n=0;n<t.length;n++)t[n]&&(e[t[n]]=1);return e}({},d(g+(l?y:""))),w=function(){var e="compareDocumentPosition"in f?function(e,t){return t.compareDocumentPosition&&(t.compareDocumentPosition(e)&16)===16}:"contains"in f?function(e,t){return t=t.nodeType===9||t===window?f:t,t!==e&&t.contains(e)}:function(e,t){while(e=e.parentNode)if(e===t)return 1;return 0},t=function(t){var n=t.relatedTarget;return n?n!==this&&n.prefix!=="xul"&&!/document/.test(this.toString())&&!e(n,this):n==null};return{mouseenter:{base:"mouseover",condition:t},mouseleave:{base:"mouseout",condition:t},mousewheel:{base:/Firefox/.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel"}}}(),E=function(){var e=d("altKey attrChange attrName bubbles cancelable ctrlKey currentTarget detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey srcElement target timeStamp type view which propertyName"),t=e.concat(d("button buttons clientX clientY dataTransfer fromElement offsetX offsetY pageX pageY screenX screenY toElement")),r=t.concat(d("wheelDelta wheelDeltaX wheelDeltaY wheelDeltaZ axis")),i=e.concat(d("char charCode key keyCode keyIdentifier keyLocation location")),s=e.concat(d("data")),o=e.concat(d("touches targetTouches changedTouches scale rotation")),u=e.concat(d("data origin source")),l=e.concat(d("state")),c=/over|out/,h=[{reg:/key/i,fix:function(e,t){return t.keyCode=e.which||e.keyCode,i}},{reg:/click|mouse(?!(.*wheel|scroll))|menu|drag|drop/i,fix:function(e,n,r){n.rightClick=e.which===3||e.button===2,n.pos={x:0,y:0};if(e.pageX||e.pageY)n.clientX=e.pageX,n.clientY=e.pageY;else if(e.clientX||e.clientY)n.clientX=e.clientX+a.body.scrollLeft+f.scrollLeft,n.clientY=e.clientY+a.body.scrollTop+f.scrollTop;return c.test(r)&&(n.relatedTarget=e.relatedTarget||e[(r=="mouseover"?"from":"to")+"Element"]),t}},{reg:/mouse.*(wheel|scroll)/i,fix:function(){return r}},{reg:/^text/i,fix:function(){return s}},{reg:/^touch|^gesture/i,fix:function(){return o}},{reg:/^message$/i,fix:function(){return u}},{reg:/^popstate$/i,fix:function(){return l}},{reg:/.*/,fix:function(){return e}}],p={},v=function(e,t,r){if(!arguments.length)return;e=e||((t.ownerDocument||t.document||t).parentWindow||n).event,this.originalEvent=e,this.isNative=r,this.isBean=!0;if(!e)return;var i=e.type,s=e.target||e.srcElement,o,u,a,f,l;this.target=s&&s.nodeType===3?s.parentNode:s;if(r){l=p[i];if(!l)for(o=0,u=h.length;o<u;o++)if(h[o].reg.test(i)){p[i]=l=h[o].fix;break}f=l(e,this,i);for(o=f.length;o--;)!((a=f[o])in this)&&a in e&&(this[a]=e[a])}};return v.prototype.preventDefault=function(){this.originalEvent.preventDefault?this.originalEvent.preventDefault():this.originalEvent.returnValue=!1},v.prototype.stopPropagation=function(){this.originalEvent.stopPropagation?this.originalEvent.stopPropagation():this.originalEvent.cancelBubble=!0},v.prototype.stop=function(){this.preventDefault(),this.stopPropagation(),this.stopped=!0},v.prototype.stopImmediatePropagation=function(){this.originalEvent.stopImmediatePropagation&&this.originalEvent.stopImmediatePropagation(),this.isImmediatePropagationStopped=function(){return!0}},v.prototype.isImmediatePropagationStopped=function(){return this.originalEvent.isImmediatePropagationStopped&&this.originalEvent.isImmediatePropagationStopped()},v.prototype.clone=function(e){var t=new v(this,this.element,this.isNative);return t.currentTarget=e,t},v}(),S=function(e,t){return!l&&!t&&(e===a||e===n)?f:e},x=function(){var e=function(e,t,n,r){var i=function(n,i){return t.apply(e,r?p.call(i,n?0:1).concat(r):i)},s=function(n,r){return t.__beanDel?t.__beanDel.ft(n.target,e):r},o=n?function(e){var t=s(e,this);if(n.apply(t,arguments))return e&&(e.currentTarget=t),i(e,arguments)}:function(e){return t.__beanDel&&(e=e.clone(s(e))),i(e,arguments)};return o.__beanDel=t.__beanDel,o},t=function(t,n,r,i,s,o,u){var a=w[n],f;n=="unload"&&(r=A(O,t,n,r,i)),a&&(a.condition&&(r=e(t,r,a.condition,o)),n=a.base||n),this.isNative=f=b[n]&&!!t[c],this.customType=!l&&!f&&n,this.element=t,this.type=n,this.original=i,this.namespaces=s,this.eventType=l||f?n:"propertychange",this.target=S(t,f),this[c]=!!this.target[c],this.root=u,this.handler=e(t,r,null,o)};return t.prototype.inNamespaces=function(e){var t,n,r=0;if(!e)return!0;if(!this.namespaces)return!1;for(t=e.length;t--;)for(n=this.namespaces.length;n--;)e[t]==this.namespaces[n]&&r++;return e.length===r},t.prototype.matches=function(e,t,n){return this.element===e&&(!t||this.original===t)&&(!n||this.handler===n)},t}(),T=function(){var e={},t=function(n,r,i,s,o,u){var a=o?"r":"$";if(!r||r=="*")for(var f in e)f.charAt(0)==a&&t(n,f.substr(1),i,s,o,u);else{var l=0,c,h=e[a+r],p=n=="*";if(!h)return;for(c=h.length;l<c;l++)if((p||h[l].matches(n,i,s))&&!u(h[l],h,l,r))return}},n=function(t,n,r,i){var s,o=e[(i?"r":"$")+n];if(o)for(s=o.length;s--;)if(!o[s].root&&o[s].matches(t,r,null))return!0;return!1},r=function(e,n,r,i){var s=[];return t(e,n,r,null,i,function(e){return s.push(e)}),s},i=function(t){var n=!t.root&&!this.has(t.element,t.type,null,!1),r=(t.root?"r":"$")+t.type;return(e[r]||(e[r]=[])).push(t),n},s=function(n){t(n.element,n.type,null,n.handler,n.root,function(t,n,r){return n.splice(r,1),t.removed=!0,n.length===0&&delete e[(t.root?"r":"$")+t.type],!1})},o=function(){var t,n=[];for(t in e)t.charAt(0)=="$"&&(n=n.concat(e[t]));return n};return{has:n,get:r,put:i,del:s,entries:o}}(),N,C=function(e){arguments.length?N=e:N=a.querySelectorAll?function(e,t){return t.querySelectorAll(e)}:function(){throw new Error("Bean: No selector engine installed")}},k=function(e,t){if(!l&&t&&e&&e.propertyName!="_on"+t)return;var n=T.get(this,t||e.type,null,!1),r=n.length,i=0;e=new E(e,this,!0),t&&(e.type=t);for(;i<r&&!e.isImmediatePropagationStopped();i++)n[i].removed||n[i].handler.call(this,e)},L=l?function(e,t,n){e[n?o:u](t,k,!1)}:function(e,t,n,r){var i;n?(T.put(i=new x(e,r||t,function(t){k.call(e,t,r)},k,null,null,!0)),r&&e["_on"+r]==null&&(e["_on"+r]=0),i.target.attachEvent("on"+i.eventType,i.handler)):(i=T.get(e,r||t,k,!0)[0],i&&(i.target.detachEvent("on"+i.eventType,i.handler),T.del(i)))},A=function(e,t,n,r,i){return function(){r.apply(this,arguments),e(t,n,i)}},O=function(e,t,n,r){var i=t&&t.replace(s,""),o=T.get(e,i,null,!1),u={},a,f;for(a=0,f=o.length;a<f;a++)(!n||o[a].original===n)&&o[a].inNamespaces(r)&&(T.del(o[a]),!u[o[a].eventType]&&o[a][c]&&(u[o[a].eventType]={t:o[a].eventType,c:o[a].type}));for(a in u)T.has(e,u[a].t,null,!1)||L(e,u[a].t,!1,u[a].c)},M=function(e,t){var n=function(t,n){var r,i=v(e)?N(e,n):e;for(;t&&t!==n;t=t.parentNode)for(r=i.length;r--;)if(i[r]===t)return t},r=function(e){var r=n(e.target,this);r&&t.apply(r,arguments)};return r.__beanDel={ft:n,selector:e},r},_=l?function(e,t,r){var i=a.createEvent(e?"HTMLEvents":"UIEvents");i[e?"initEvent":"initUIEvent"](t,!0,!0,n,1),r.dispatchEvent(i)}:function(e,t,n){n=S(n,e),e?n.fireEvent("on"+t,a.createEventObject()):n["_on"+t]++},D=function(e,t,n){var r=v(t),o,u,a,f;if(r&&t.indexOf(" ")>0){t=d(t);for(f=t.length;f--;)D(e,t[f],n);return e}u=r&&t.replace(s,""),u&&w[u]&&(u=w[u].type);if(!t||r){if(a=r&&t.replace(i,""))a=d(a,".");O(e,u,n,a)}else if(m(t))O(e,null,t);else for(o in t)t.hasOwnProperty(o)&&D(e,o,t[o]);return e},P=function(e,t,n,r){var o,u,a,f,l,v,g;if(n===undefined&&typeof t=="object"){for(u in t)t.hasOwnProperty(u)&&P.call(this,e,u,t[u]);return}m(n)?(l=p.call(arguments,3),r=o=n):(o=r,l=p.call(arguments,4),r=M(n,o,N)),a=d(t),this===h&&(r=A(D,e,t,r,o));for(f=a.length;f--;)g=T.put(v=new x(e,a[f].replace(s,""),r,o,d(a[f].replace(i,""),"."),l,!1)),v[c]&&g&&L(e,v.eventType,!0,v.customType);return e},H=function(e,t,n,r){return P.apply(null,v(n)?[e,n,t,r].concat(arguments.length>3?p.call(arguments,5):[]):p.call(arguments))},B=function(){return P.apply(h,arguments)},j=function(e,t,n){var r=d(t),o,u,a,f,l;for(o=r.length;o--;){t=r[o].replace(s,"");if(f=r[o].replace(i,""))f=d(f,".");if(!f&&!n&&e[c])_(b[t],t,e);else{l=T.get(e,t,null,!1),n=[!1].concat(n);for(u=0,a=l.length;u<a;u++)l[u].inNamespaces(f)&&l[u].handler.apply(e,n)}}return e},F=function(e,t,n){var r=T.get(t,n,null,!1),i=r.length,s=0,o,u;for(;s<i;s++)r[s].original&&(o=[e,r[s].type],(u=r[s].handler.__beanDel)&&o.push(u.selector),o.push(r[s].original),P.apply(null,o));return e},I={on:P,add:H,one:B,off:D,remove:D,clone:F,fire:j,setSelectorEngine:C,noConflict:function(){return t[e]=r,this}};if(n.attachEvent){var q=function(){var e,t=T.entries();for(e in t)t[e].type&&t[e].type!=="unload"&&D(t[e].element,t[e].type);n.detachEvent("onunload",q),n.CollectGarbage&&n.CollectGarbage()};n.attachEvent("onunload",q)}return C(),I}) | ||
!function(e,t,n){typeof module!="undefined"&&module.exports?module.exports=n(e,t):typeof define=="function"&&typeof define.amd=="object"?define(n):t[e]=n(e,t)}("bean",this,function(e,t){var n=window,r=t[e],i=/[^\.]*(?=\..*)\.|.*/,s=/\..*/,o="addEventListener",u="removeEventListener",a=document||{},f=a.documentElement||{},l=f[o],c=l?o:"attachEvent",h={},p=Array.prototype.slice,d=function(e,t){return e.split(t||" ")},v=function(e){return typeof e=="string"},m=function(e){return typeof e=="function"},g="click dblclick mouseup mousedown contextmenu mousewheel mousemultiwheel DOMMouseScroll mouseover mouseout mousemove selectstart selectend keydown keypress keyup orientationchange focus blur change reset select submit load unload beforeunload resize move DOMContentLoaded readystatechange message error abort scroll ",y="show input invalid touchstart touchmove touchend touchcancel gesturestart gesturechange gestureend textinputreadystatechange pageshow pagehide popstate hashchange offline online afterprint beforeprint dragstart dragenter dragover dragleave drag drop dragend loadstart progress suspend emptied stalled loadmetadata loadeddata canplay canplaythrough playing waiting seeking seeked ended durationchange timeupdate play pause ratechange volumechange cuechange checking noupdate downloading cached updateready obsolete ",b=function(e,t,n){for(n=0;n<t.length;n++)t[n]&&(e[t[n]]=1);return e}({},d(g+(l?y:""))),w=function(){var e="compareDocumentPosition"in f?function(e,t){return t.compareDocumentPosition&&(t.compareDocumentPosition(e)&16)===16}:"contains"in f?function(e,t){return t=t.nodeType===9||t===window?f:t,t!==e&&t.contains(e)}:function(e,t){while(e=e.parentNode)if(e===t)return 1;return 0},t=function(t){var n=t.relatedTarget;return n?n!==this&&n.prefix!=="xul"&&!/document/.test(this.toString())&&!e(n,this):n==null};return{mouseenter:{base:"mouseover",condition:t},mouseleave:{base:"mouseout",condition:t},mousewheel:{base:/Firefox/.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel"}}}(),E=function(){var e=d("altKey attrChange attrName bubbles cancelable ctrlKey currentTarget detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey srcElement target timeStamp type view which propertyName"),t=e.concat(d("button buttons clientX clientY dataTransfer fromElement offsetX offsetY pageX pageY screenX screenY toElement")),r=t.concat(d("wheelDelta wheelDeltaX wheelDeltaY wheelDeltaZ axis")),i=e.concat(d("char charCode key keyCode keyIdentifier keyLocation location")),s=e.concat(d("data")),o=e.concat(d("touches targetTouches changedTouches scale rotation")),u=e.concat(d("data origin source")),l=e.concat(d("state")),c=/over|out/,h=[{reg:/key/i,fix:function(e,t){return t.keyCode=e.which||e.keyCode,i}},{reg:/click|mouse(?!(.*wheel|scroll))|menu|drag|drop/i,fix:function(e,n,r){n.rightClick=e.which===3||e.button===2,n.pos={x:0,y:0};if(e.pageX||e.pageY)n.clientX=e.pageX,n.clientY=e.pageY;else if(e.clientX||e.clientY)n.clientX=e.clientX+a.body.scrollLeft+f.scrollLeft,n.clientY=e.clientY+a.body.scrollTop+f.scrollTop;return c.test(r)&&(n.relatedTarget=e.relatedTarget||e[(r=="mouseover"?"from":"to")+"Element"]),t}},{reg:/mouse.*(wheel|scroll)/i,fix:function(){return r}},{reg:/^text/i,fix:function(){return s}},{reg:/^touch|^gesture/i,fix:function(){return o}},{reg:/^message$/i,fix:function(){return u}},{reg:/^popstate$/i,fix:function(){return l}},{reg:/.*/,fix:function(){return e}}],p={},v=function(e,t,r){if(!arguments.length)return;e=e||((t.ownerDocument||t.document||t).parentWindow||n).event,this.originalEvent=e,this.isNative=r,this.isBean=!0;if(!e)return;var i=e.type,s=e.target||e.srcElement,o,u,a,f,l;this.target=s&&s.nodeType===3?s.parentNode:s;if(r){l=p[i];if(!l)for(o=0,u=h.length;o<u;o++)if(h[o].reg.test(i)){p[i]=l=h[o].fix;break}f=l(e,this,i);for(o=f.length;o--;)!((a=f[o])in this)&&a in e&&(this[a]=e[a])}};return v.prototype.preventDefault=function(){this.originalEvent.preventDefault?this.originalEvent.preventDefault():this.originalEvent.returnValue=!1},v.prototype.stopPropagation=function(){this.originalEvent.stopPropagation?this.originalEvent.stopPropagation():this.originalEvent.cancelBubble=!0},v.prototype.stop=function(){this.preventDefault(),this.stopPropagation(),this.stopped=!0},v.prototype.stopImmediatePropagation=function(){this.originalEvent.stopImmediatePropagation&&this.originalEvent.stopImmediatePropagation(),this.isImmediatePropagationStopped=function(){return!0}},v.prototype.isImmediatePropagationStopped=function(){return this.originalEvent.isImmediatePropagationStopped&&this.originalEvent.isImmediatePropagationStopped()},v.prototype.clone=function(e){var t=new v(this,this.element,this.isNative);return t.currentTarget=e,t},v}(),S=function(e,t){return!l&&!t&&(e===a||e===n)?f:e},x=function(){var e=function(e,t,n,r){var i=function(n,i){return t.apply(e,r?p.call(i,n?0:1).concat(r):i)},s=function(n,r){return t.__beanDel?t.__beanDel.ft(n.target,e):r},o=n?function(e){var t=s(e,this);if(n.apply(t,arguments))return e&&(e.currentTarget=t),i(e,arguments)}:function(e){return t.__beanDel&&(e=e.clone(s(e))),i(e,arguments)};return o.__beanDel=t.__beanDel,o},t=function(t,n,r,i,s,o,u){var a=w[n],f;n=="unload"&&(r=A(O,t,n,r,i)),a&&(a.condition&&(r=e(t,r,a.condition,o)),n=a.base||n),this.isNative=f=b[n]&&!!t[c],this.customType=!l&&!f&&n,this.element=t,this.type=n,this.original=i,this.namespaces=s,this.eventType=l||f?n:"propertychange",this.target=S(t,f),this[c]=!!this.target[c],this.root=u,this.handler=e(t,r,null,o)};return t.prototype.inNamespaces=function(e){var t,n,r=0;if(!e)return!0;if(!this.namespaces)return!1;for(t=e.length;t--;)for(n=this.namespaces.length;n--;)e[t]==this.namespaces[n]&&r++;return e.length===r},t.prototype.matches=function(e,t,n){return this.element===e&&(!t||this.original===t)&&(!n||this.handler===n)},t}(),T=function(){var e={},t=function(n,r,i,s,o,u){var a=o?"r":"$";if(!r||r=="*")for(var f in e)f.charAt(0)==a&&t(n,f.substr(1),i,s,o,u);else{var l=0,c,h=e[a+r],p=n=="*";if(!h)return;for(c=h.length;l<c;l++)if((p||h[l].matches(n,i,s))&&!u(h[l],h,l,r))return}},n=function(t,n,r,i){var s,o=e[(i?"r":"$")+n];if(o)for(s=o.length;s--;)if(!o[s].root&&o[s].matches(t,r,null))return!0;return!1},r=function(e,n,r,i){var s=[];return t(e,n,r,null,i,function(e){return s.push(e)}),s},i=function(t){var n=!t.root&&!this.has(t.element,t.type,null,!1),r=(t.root?"r":"$")+t.type;return(e[r]||(e[r]=[])).push(t),n},s=function(n){t(n.element,n.type,null,n.handler,n.root,function(t,n,r){return n.splice(r,1),t.removed=!0,n.length===0&&delete e[(t.root?"r":"$")+t.type],!1})},o=function(){var t,n=[];for(t in e)t.charAt(0)=="$"&&(n=n.concat(e[t]));return n};return{has:n,get:r,put:i,del:s,entries:o}}(),N,C=function(e){arguments.length?N=e:N=a.querySelectorAll?function(e,t){return t.querySelectorAll(e)}:function(){throw new Error("Bean: No selector engine installed")}},k=function(e,t){if(!l&&t&&e&&e.propertyName!="_on"+t)return;var n=T.get(this,t||e.type,null,!1),r=n.length,i=0;e=new E(e,this,!0),t&&(e.type=t);for(;i<r&&!e.isImmediatePropagationStopped();i++)n[i].removed||n[i].handler.call(this,e)},L=l?function(e,t,n){e[n?o:u](t,k,!1)}:function(e,t,n,r){var i;n?(T.put(i=new x(e,r||t,function(t){k.call(e,t,r)},k,null,null,!0)),r&&e["_on"+r]==null&&(e["_on"+r]=0),i.target.attachEvent("on"+i.eventType,i.handler)):(i=T.get(e,r||t,k,!0)[0],i&&(i.target.detachEvent("on"+i.eventType,i.handler),T.del(i)))},A=function(e,t,n,r,i){return function(){r.apply(this,arguments),e(t,n,i)}},O=function(e,t,n,r){var i=t&&t.replace(s,""),o=T.get(e,i,null,!1),u={},a,f;for(a=0,f=o.length;a<f;a++)(!n||o[a].original===n)&&o[a].inNamespaces(r)&&(T.del(o[a]),!u[o[a].eventType]&&o[a][c]&&(u[o[a].eventType]={t:o[a].eventType,c:o[a].type}));for(a in u)T.has(e,u[a].t,null,!1)||L(e,u[a].t,!1,u[a].c)},M=function(e,t){var n=function(t,n){var r,i=v(e)?N(e,n):e;for(;t&&t!==n;t=t.parentNode)for(r=i.length;r--;)if(i[r]===t)return t},r=function(e){var r=n(e.target,this);r&&t.apply(r,arguments)};return r.__beanDel={ft:n,selector:e},r},_=l?function(e,t,r){var i=a.createEvent(e?"HTMLEvents":"UIEvents");i[e?"initEvent":"initUIEvent"](t,!0,!0,n,1),r.dispatchEvent(i)}:function(e,t,n){n=S(n,e),e?n.fireEvent("on"+t,a.createEventObject()):n["_on"+t]++},D=function(e,t,n){var r=v(t),o,u,a,f;if(r&&t.indexOf(" ")>0){t=d(t);for(f=t.length;f--;)D(e,t[f],n);return e}u=r&&t.replace(s,""),u&&w[u]&&(u=w[u].type);if(!t||r){if(a=r&&t.replace(i,""))a=d(a,".");O(e,u,n,a)}else if(m(t))O(e,null,t);else for(o in t)t.hasOwnProperty(o)&&D(e,o,t[o]);return e},P=function(e,t,n,r){var o,u,a,f,l,v,g;if(n===undefined&&typeof t=="object"){for(u in t)t.hasOwnProperty(u)&&P.call(this,e,u,t[u]);return}m(n)?(l=p.call(arguments,3),r=o=n):(o=r,l=p.call(arguments,4),r=M(n,o,N)),a=d(t),this===h&&(r=A(D,e,t,r,o));for(f=a.length;f--;)g=T.put(v=new x(e,a[f].replace(s,""),r,o,d(a[f].replace(i,""),"."),l,!1)),v[c]&&g&&L(e,v.eventType,!0,v.customType);return e},H=function(e,t,n,r){return P.apply(null,v(n)?[e,n,t,r].concat(arguments.length>3?p.call(arguments,5):[]):p.call(arguments))},B=function(){return P.apply(h,arguments)},j=function(e,t,n){var r=d(t),o,u,a,f,l;for(o=r.length;o--;){t=r[o].replace(s,"");if(f=r[o].replace(i,""))f=d(f,".");if(!f&&!n&&e[c])_(b[t],t,e);else{l=T.get(e,t,null,!1),n=[!1].concat(n);for(u=0,a=l.length;u<a;u++)l[u].inNamespaces(f)&&l[u].handler.apply(e,n)}}return e},F=function(e,t,n){var r=T.get(t,n,null,!1),i=r.length,s=0,o,u;for(;s<i;s++)r[s].original&&(o=[e,r[s].type],(u=r[s].handler.__beanDel)&&o.push(u.selector),o.push(r[s].original),P.apply(null,o));return e},I={on:P,add:H,one:B,off:D,remove:D,clone:F,fire:j,setSelectorEngine:C,noConflict:function(){return t[e]=r,this}};if(n.attachEvent){var q=function(){var e,t=T.entries();for(e in t)t[e].type&&t[e].type!=="unload"&&D(t[e].element,t[e].type);n.detachEvent("onunload",q),n.CollectGarbage&&n.CollectGarbage()};n.attachEvent("onunload",q)}return C(),I}) |
{ | ||
"name": "bean" | ||
, "description": "an events api for javascript" | ||
, "version": "1.0.0a1" | ||
, "description": "A small, fast, framework-agnostic event manager" | ||
, "version": "1.0.0" | ||
, "homepage": "https://github.com/fat/bean" | ||
, "authors": [ | ||
"Jacob Thornton <@fat>" | ||
, "Rod Vagg <@rvagg>" | ||
, "Dustin Diaz <@ded>" | ||
, "Rod Vagg <@rvagg>" | ||
] | ||
@@ -15,7 +15,7 @@ , "repository": { | ||
} | ||
, "keywords": [ "ender", "events", "event" ] | ||
, "keywords": [ "ender", "events", "event", "dom" ] | ||
, "main": "./bean.js" | ||
, "devDependencies": { | ||
"buster": "~0.6.2" | ||
, "smoosh": "~0.3.x" | ||
, "smoosh": "~0.3.2" | ||
, "qwery": "~3.3.11" | ||
@@ -22,0 +22,0 @@ } |
373
README.md
@@ -1,7 +0,6 @@ | ||
Bean | ||
---- | ||
Bean is a small, slick, cross-platform, framework-agnostic event utility designed for desktop, mobile, and touch-based browsers. In its simplest form - it works like this: | ||
# Bean | ||
Bean is a small, fast, cross-platform, framework-agnostic event manager designed for desktop, mobile, and touch-based browsers. In its simplest form - it works like this: | ||
```javascript | ||
bean.add(element, 'click', function (e) { | ||
```js | ||
bean.on(element, 'click', function (e) { | ||
console.log('hello'); | ||
@@ -11,34 +10,37 @@ }); | ||
API | ||
--- | ||
Bean has five methods, each packing quite a punch. | ||
Bean is included in [Ender](http://ender.no.de)'s *starter pack*, "The Jeesh". More details on the Ender interface [below](#ender). | ||
* bean.<code>add()</code> | ||
* bean.<code>one()</code> | ||
* bean.<code>remove()</code> | ||
* bean.<code>clone()</code> | ||
* bean.<code>fire()</code> | ||
## API | ||
add() | ||
--- | ||
<code>bean.add()</code> lets you attach event listeners to both elements and objects. | ||
Bean has five main methods, each packing quite a punch. | ||
<h3>Signature</h3> | ||
* <a href="#on">bean.<code>on()</code></a> | ||
* <a href="#one">bean.<code>one()</code></a> | ||
* <a href="#off">bean.<code>off()</code></a> | ||
* <a href="#clone">bean.<code>clone()</code></a> | ||
* <a href="#fire">bean.<code>fire()</code></a> | ||
* {1} element {DOM Element} an HTML DOM element | ||
* {2} event type(s) {String} an event (or multiple events) to listen to | ||
* {3} handler {Function} the callback function | ||
-------------------------------------------------------- | ||
<a name="on"></a> | ||
### on(element, eventType[, selector], handler[, args ]) | ||
<code>bean.on()</code> lets you attach event listeners to both elements and objects. | ||
* {2,3} handlers {Object} a list of event keys with callback functions as the values | ||
**Arguments** | ||
* {4,n} optional args | ||
* **element / object** (DOM Element or Object) - an HTML DOM element or any JavaScript Object | ||
* **event type(s)** (String) - an event (or multiple events, space separated) to listen to | ||
* **selector** (optional String) - a CSS DOM Element selector string to bind the listener to child elements matching the selector | ||
* **handler** (Function) - the callback function | ||
* **args** (optional) - additional arguments to pas to the callback function when triggered | ||
<h3>Examples</h3> | ||
Optionally, event types and handlers can be passed in an object of the form `{ 'eventType': handler }` as the second argument. | ||
```javascript | ||
**Examples** | ||
```js | ||
// simple | ||
bean.add(element, 'click', handler); | ||
bean.on(element, 'click', handler); | ||
// optional arguments passed to handler | ||
bean.add(element, 'click', function(e, o1, o2) { | ||
bean.on(element, 'click', function(e, o1, o2) { | ||
console.log(o1, o2); | ||
@@ -48,6 +50,6 @@ }, 'fat', 'ded'); | ||
// multiple events | ||
bean.add(element, 'keydown keyup', handler); | ||
bean.on(element, 'keydown keyup', handler); | ||
// multiple handlers | ||
bean.add(element, { | ||
bean.on(element, { | ||
click: function (e) {}, | ||
@@ -57,69 +59,106 @@ mouseover: function (e) {}, | ||
}); | ||
``` | ||
**Delegation** | ||
A String as the 3rd argument to `on()` will be interpreted as a selector for event delegation. Events for child elements will cause the element to be checked against the selector and the event to be fired if a match is found. The event behaves the same way as if you listened directly to the element it was fired on. | ||
```js | ||
// event delegated events | ||
bean.add(element, '.content p', 'click', handler); | ||
bean.on(element, 'click', '.content p', handler); | ||
// Alternatively, you can pass an array of elements. | ||
// This cuts down on selector engine work, and is a more performant means of | ||
// delegation if you know your DOM won't be changing: | ||
bean.on(element, [el, el2, el3], 'click', handler); | ||
bean.on(element, $('.myClass'), 'click', handler); | ||
``` | ||
**Note**: the 5th parameter (selector engine) of previous Bean releases is now deprecated and will be removed in future versions. Use `setSelectorEngine()` instead. | ||
**Notes** | ||
Or alternatively, you can pass an array of elements (this actually cuts down on selector engine work, and is a more performant means of delegation if you know your DOM won't be changing: | ||
* Prior to v1, Bean used `add()` as its primary handler-adding interface, it still exists but uses the original argument order for delegated events: `add(element[, selector], eventType, handler[, args ])`. This may be removed in future versions of Bean. | ||
```javascript | ||
bean.add(element, [el, el2, el3], 'click', handler); | ||
//or | ||
bean.add(element, $('.myClass'), 'click', handler); | ||
``` | ||
* The focus, blur, and submit events will not delegate due to [vagaries](http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html) of the DOM model. This *may* be addressed in a future version of Bean. | ||
*(note: the focus, blur, and submit events will not delegate)* | ||
**Namespacing** | ||
<h3>Namespacing</h3> | ||
Bean also now supports namespacing your events! This makes it much easier to target them down the line with things like remove or fire. To name space an event just add a dot followed by your unique name identifier: | ||
Bean supports namespacing your events. This makes it much easier to target the handlers later when using `off()` or `fire()`, both of these methods match namespaced handlers in the same way. | ||
```javascript | ||
bean.add(element, 'click.fat', fn); | ||
bean.add(element, 'click.ded', fn); | ||
bean.add(element, 'click', fn); | ||
To namespace an event just add a dot followed by your unique name identifier: | ||
//later... | ||
bean.fire(element, 'click.ded'); | ||
bean.remove(element, 'click.fat'); | ||
```js | ||
bean.on(element, 'click.fat.foo', fn); // 1 | ||
bean.on(element, 'click.ded', fn); // 2 | ||
bean.on(element, 'click', fn); // 3 | ||
//alternatively you can specify mutliple remove or fire handlers at once | ||
bean.fire(element, 'click.ded.fat'); | ||
bean.remove(element, 'click.fat.ded'); | ||
// later: | ||
bean.fire(element, 'click.ded'); // trigger 2 | ||
bean.fire(element, 'click.fat'); // trigger 3 | ||
bean.off(element, 'click'); // remove 1, 2 & 3 | ||
// fire() & off() match multiple namespaces with AND, not OR: | ||
bean.fire(element, 'click.fat.foo'); // trigger 1 | ||
bean.off(element, 'click.fat.ded'); // remove nothing | ||
``` | ||
one() | ||
--- | ||
<code>bean.one()</code> is an alias for <code>bean.add()</code> except that the handler will only be executed once and then removed for the event type(s). | ||
**Notes** | ||
remove() | ||
------ | ||
<code>bean.remove()</code> is how you get rid of listeners once you no longer want them. It's also a good idea to call remove on elements before you remove elements from your dom (this gives Bean a chance to clean up some things and prevents memory leaks) | ||
* Prior to v1, Bean matched multiple namespaces in `fire()` and `remove()` calls using OR rather than AND. | ||
```javascript | ||
-------------------------------------------------------- | ||
<a name="one"></a> | ||
### one(element, eventType[, selector], handler[, args ]) | ||
<code>bean.one()</code> is an alias for <code>bean.on()</code> except that the handler will only be executed once and then removed for the event type(s). | ||
**Notes** | ||
* Prior to v1, `one()` used the same argument ordering as `add()` (see note above), it now uses the new `on()` ordering. | ||
-------------------------------------------------------- | ||
<a name="off"></a> | ||
### off(element[, eventType[, handler ]]) | ||
<code>bean.off()</code> is how you get rid of handlers once you no longer want them active. It's also a good idea to call *off* on elements before you remove them from your DOM; this gives Bean a chance to clean up some things and prevents memory leaks. | ||
**Arguments** | ||
* **element / object** (DOM Element or Object) - an HTML DOM element or any JavaScript Object | ||
* **event type(s)** (optional String) - an event (or multiple events, space separated) to remove | ||
* **handler** (optional Function) - the specific callback function to remove | ||
Optionally, event types and handlers can be passed in an object of the form `{ 'eventType': handler }` as the second argument, just like `on()`. | ||
**Examples** | ||
```js | ||
// remove a single event handlers | ||
bean.remove(element, 'click', handler); | ||
bean.off(element, 'click', handler); | ||
// remove all click handlers | ||
bean.remove(element, 'click'); | ||
bean.off(element, 'click'); | ||
// remove handler for all events | ||
bean.remove(element, handler); | ||
bean.off(element, handler); | ||
// remove multiple events | ||
bean.remove(element, 'mousedown mouseup'); | ||
bean.off(element, 'mousedown mouseup'); | ||
// remove all events | ||
bean.remove(element); | ||
bean.off(element); | ||
// remove handlers for events using object literal | ||
bean.remove(element, { click: clickHandler, keyup: keyupHandler }) | ||
bean.off(element, { click: clickHandler, keyup: keyupHandler }) | ||
``` | ||
clone() | ||
----- | ||
<code>bean.clone()</code> is a method for cloning events from one element to another. | ||
**Notes** | ||
```javascript | ||
* Prior to Bean v1, `remove()` was the primary removal interface. This is retained as an alias for backward compatibility but may eventually be removed. | ||
-------------------------------------------------------- | ||
<a name="clone"></a> | ||
### clone(destElement, srcElement[, eventType ]) | ||
<code>bean.clone()</code> is a method for cloning events from one DOM element or object to another. | ||
**Examples** | ||
```js | ||
// clone all events at once by doing this: | ||
@@ -132,7 +171,10 @@ bean.clone(toElement, fromElement); | ||
fire() | ||
---- | ||
-------------------------------------------------------- | ||
<a name="fire"></a> | ||
### fire(element, eventType[, args ]) | ||
<code>bean.fire()</code> gives you the ability to trigger events. | ||
```javascript | ||
**Examples** | ||
```js | ||
// fire a single event on an element | ||
@@ -145,112 +187,94 @@ bean.fire(element, 'click'); | ||
setSelectorEngine() | ||
---- | ||
<code>bean.setSelectorEngine()</code> allows you to set a default selector engine for all your delegation needs. | ||
**Notes** | ||
```javascript | ||
bean.setSelectorEngine(qwery); | ||
``` | ||
* An optional args array may be passed to `fire()` which will in turn be passed to the event handlers. Handlers will be triggered manually, outside of the DOM, even if you're trying to fire standard DOM events. | ||
**Note**: `querySelectorAll()` is used as the default selector engine, this is available on most modern platforms such as mobile WebKit. To support event delegation on older browsers you will need to install a selector engine. | ||
Custom events | ||
------------- | ||
Bean uses methods similar to [Dean Edwards' event model](http://dean.edwards.name/weblog/2009/03/callbacks-vs-events/) to ensure custom events behave like real events, rather than just callbacks. | ||
-------------------------------------------------------- | ||
<a name="setSelectorEngine"></a> | ||
### setSelectorEngine(selectorEngine) | ||
<code>bean.setSelectorEngine()</code> allows you to set a default selector engine for all your delegation needs. | ||
For all intents and purposes, you can just think of them as native events, which will bubble up, and everything else you would expect... | ||
The selector engine simply needs to be a function that takes two arguments: a selector string and a root element, it should return an array of matched DOM elements. [Qwery](https://github.com/ded/qwery), [Sel](https://github.com/amccollum/sel), [Sizzle](https://github.com/jquery/sizzle), [NWMatcher](https://github.com/dperini/nwmatcher) and other selector engines should all be compatible with Bean. | ||
use them like this: | ||
**Examples** | ||
```javascript | ||
bean.add(element, 'partytime', handler); | ||
bean.fire(element, 'partytime'); | ||
```js | ||
bean.setSelectorEngine(qwery); | ||
``` | ||
mouseenter, mouseleave | ||
---------------------- | ||
Bean provides you with two custom DOM events, <code>mouseenter</code> and <code>mouseleave</code>. They are essentially just helpers for making your mouseover/mouseout lives a bit easier. | ||
**Notes** | ||
use them like regular events: | ||
* `querySelectorAll()` is used as the default selector engine, this is available on most modern platforms such as mobile WebKit. To support event delegation on older browsers you will need to install a selector engine. | ||
bean.add(element, 'mouseenter', handler); | ||
## The `Event` object | ||
Object support | ||
-------------- | ||
Good news, everything you can do in Bean with an element, you can also do with an object! This is particularly useful for working with classes or plugins. | ||
Bean implements a variant of the standard DOM `Event` object, supplied as the argument to your DOM event handler functions. Bean wraps and *fixes* the native `Event` object where required, providing a consistent interface across browsers. | ||
```javascript | ||
var inst = new Klass(); | ||
bean.add(inst, 'complete', handler); | ||
```js | ||
// prevent default behavior and propagation (even works on old IE) | ||
bean.on(el, 'click', function (event) { | ||
event.preventDefault(); | ||
event.stopPropagation(); | ||
}); | ||
//later on... | ||
bean.fire(inst, 'complete'); | ||
// a simple shortcut version of the above code | ||
bean.on(el, 'click', function (event) { | ||
event.stop(); | ||
}); | ||
// prevent all subsequent handlers from being triggered for this particular event | ||
bean.on(el, 'click', function (event) { | ||
event.stopImmediatePropagation(); | ||
}); | ||
``` | ||
Browser Support | ||
--------------- | ||
Bean passes our tests in all the following browsers. If you've found bugs in these browsers or others please let us know! | ||
**Notes** | ||
- IE6, IE7, IE8, IE9 | ||
- Chrome 1-10 | ||
- Safari 4-5 | ||
- Firefox 3, 4 | ||
* Your mileage with the `Event` methods (`preventDefault` etc.) may vary with delegated events as the events are not intercepted at the element in question. | ||
Other important browser notes | ||
-------------- | ||
One of the great things about Bean is that it fixes a number of distinguishable browser differences and also provides proper cross-platform support for certain special events. | ||
## Custom events | ||
```javascript | ||
// normalized browser event model for default behavior and propagation | ||
bean.add(el, 'click', function (e) { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
}); | ||
Bean uses methods similar to [Dean Edwards' event model](http://dean.edwards.name/weblog/2009/03/callbacks-vs-events/) to ensure custom events behave like real events, rather than just callbacks. | ||
// a simple shortcut, since you usually want preventDefault() and stopPropagation() at the same time | ||
// (works the same as the previous example) | ||
bean.add(el, 'click', function (e) { | ||
e.stop(); | ||
}); | ||
For all intents and purposes, you can just think of them as native DOM events, which will bubble up and behave you would expect. | ||
// Note that your mileage with e.stop() may vary with delegated events as the events are not | ||
// intercepted at the element in question | ||
**Examples** | ||
// DOMContentLoaded | ||
bean.add(document, 'DOMContentLoaded', fn); | ||
```js | ||
bean.on(element, 'partytime', handler); | ||
bean.fire(element, 'partytime'); | ||
``` | ||
// mousewheel | ||
bean.add(el, 'mousewheel', fn); | ||
## mouseenter, mouseleave | ||
// mobile | ||
bean.add(window, 'orientationchange', fn); | ||
Bean provides you with two custom DOM events, *'mouseenter'* and *'mouseleave'*. They are essentially just helpers for making your mouseover / mouseout lives a bit easier. | ||
// touch events | ||
bean.add(el, 'touchstart touchmove touchend touchcancel', fn); | ||
**Examples** | ||
// gestures | ||
bean.add(el, 'gesturestart gesturechange gestureend', fn); | ||
```js | ||
bean.on(element, 'mouseenter', enterHandler); | ||
bean.on(element, 'mouseleave', leaveHandler); | ||
``` | ||
Building Bean | ||
------------- | ||
## Object support | ||
Bean uses [JSHint](http://www.jshint.com/) to keep some house rules as well as [UglifyJS](https://github.com/mishoo/UglifyJS) for its compression. For those interested in building Bean yourself, first install the development dependencies with *npm install* in the root of the project and then run *make* to build the project. | ||
Everything you can do in Bean with an element, you can also do with an object. This is particularly useful for working with classes or plugins. | ||
Tests | ||
----- | ||
```js | ||
var inst = new Klass(); | ||
bean.on(inst, 'complete', handler); | ||
Bean uses [BusterJS](http://busterjs.org/) for its unit tests. *npm install* will install Buster for you and then you can simply point your browser at <code>bean/tests/tests.html</code>. | ||
//later on... | ||
bean.fire(inst, 'complete'); | ||
``` | ||
A Buster configuration file also exists so you can use *buster-server* to run a capture server to attach multiple browsers to and then *buster-test* to run the tests. | ||
<a name="ender"></a> | ||
## Ender Integration API | ||
Ender Integration API | ||
--------------------- | ||
If you use Bean with Ender its API is greatly extended through its bridge file. This extension aims to give Bean the look and feel of jQuery. | ||
If you use Bean with Ender its API is greatly extended through its bridge file. This extension aims to give Bean the look and feel of jQuery, but at the tiny size of Bean. | ||
**Add events** | ||
Here's the run down of the method alias' added... | ||
**ADD EVENTS** | ||
+ on - <code>$(element).on('click', fn);</code> *NOTE: This API is likely to change slightly in the near future see [#55](https://github.com/fat/bean/issues/55)* | ||
+ on - <code>$(element).on('click', fn);</code> | ||
+ addListener - <code>$(element).addListener('click', fn);</code> | ||
@@ -260,5 +284,5 @@ + bind - <code>$(element).bind('click', fn);</code> | ||
**Remove events** | ||
**REMOVE EVENTS** | ||
+ off - <code>$(element).off('click');</code> | ||
+ unbind - <code>$(element).unbind('click');</code> | ||
@@ -268,20 +292,18 @@ + unlisten - <code>$(element).unlisten('click');</code> | ||
**Delegate events** | ||
**DELEGATE EVENTS** | ||
+ on - <code>$(element).on('click', '.foo', fn);</code> | ||
+ delegate - <code>$(element).delegate('.foo', 'click', fn);</code> | ||
+ undelegate - <code>$(element).undelegate('.foo', 'click');</code> | ||
**Clone events** | ||
**CLONE EVENTS** | ||
+ cloneEvents - <code>$(element).cloneEvents('.foo', fn);</code> | ||
**Custom events** | ||
**CUSTOM EVENTS** | ||
+ fire / emit / trigger - <code>$(element).trigger('click')</code> | ||
+ fire / emit / trigger - <code>$(element).trigger('click') | ||
**Special events** | ||
**SPECIAL EVENTS** | ||
+ hover - <code>$(element).hover(enterfn, leavefn);</code> | ||
@@ -310,7 +332,38 @@ + blur - <code>$(element).blur(fn);</code> | ||
Contributors | ||
------- | ||
## Browser support | ||
* [Dustin Diaz](https://github.com/fat/bean/commits/master?author=ded) | ||
* [Jacob Thornton](https://github.com/fat/bean/commits/master?author=fat) | ||
* Follow our software [@dedfat](http://twitter.com/dedfat) | ||
Bean passes our tests in all the following browsers. If you've found bugs in these browsers or others please let us know by submitting an issue on GitHub! | ||
- IE6+ | ||
- Chrome 1+ | ||
- Safari 4+ | ||
- Firefox 3.5+ | ||
- Opera 10+ | ||
## Contributing | ||
Bean uses [BusterJS](http://busterjs.org/) for its unit tests. `npm install` will install Buster and other required development dependencies for you and then you can simply point your browser at *bean/tests/tests.html*. | ||
A Buster configuration file also exists so you can use `buster-server` to run a capture server to attach multiple browsers to and then `buster-test` to run the tests (if you don't have Buster installed globally, you can find the executables in *node_modules/.bin/*). | ||
We're more than happy to consider pull requests, however major features that have not been previously discussed may risk being rejected. Feel free to open an issue on GitHub for discussion or questions. | ||
Contributions should stick with Bean's coding style: comma-first, semicolon-free and two-space indenting. Non-trivial contributions should come with unit tests also, feel free to ask questions if you have trouble. | ||
Running `make` will assemble the *bean.js* file in the root of the repository. Please be aware that any contributions to bean should be in *src/bean.js* or they will be lost! | ||
## Contributors | ||
* [Jacob Thornton](https://github.com/fat/bean/commits/master?author=fat) ([GitHub](https://github.com/fat) - [Twitter](https://twitter.com/fat)) | ||
* [Rod Vagg](https://github.com/fat/bean/commits/master?author=rvagg) ([GitHub](https://github.com/rvagg) - [Twitter](https://twitter.com/rvagg)) | ||
* [Dustin Diaz](https://github.com/fat/bean/commits/master?author=ded) ([GitHub](https://github.com/ded) - [Twitter](https://twitter.com/ded)) | ||
Special thanks to: | ||
* [Dean Edwards](http://dean.edwards.name/) | ||
* [Diego Perini](https://github.com/dperini/nwevents) | ||
* [The entire MooTools team](https://github.com/mootools/mootools-core) | ||
## Licence & copyright | ||
Bean is copyright © 2011-2012 Jacob Thornton and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. |
!(function (name, context, definition) { | ||
if (typeof module != 'undefined') module.exports = definition(name, context); | ||
if (typeof module != 'undefined' && module.exports) module.exports = definition(name, context); | ||
else if (typeof define == 'function' && typeof define.amd == 'object') define(definition); | ||
@@ -579,2 +579,3 @@ else context[name] = definition(name, context); | ||
//TODO: the undefined check means you can't pass an 'args' argument, fix this perhaps? | ||
if (selector === undefined && typeof events == 'object') { | ||
@@ -732,2 +733,2 @@ //TODO: this can't handle delegated events | ||
return bean | ||
})); | ||
})); |
/*! | ||
* bean.js - copyright Jacob Thornton 2011 | ||
* Bean - copyright (c) Jacob Thornton 2011-2012 | ||
* https://github.com/fat/bean | ||
* 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 | ||
* MIT license | ||
*/ |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
232817
30
0
361
0
0
5246