From de004e300f83972dd621fe12966e43350e9b4fd8 Mon Sep 17 00:00:00 2001 From: Vytautas Jakutis Date: Thu, 20 Mar 2014 11:27:59 +0000 Subject: [PATCH 1/3] support being evaluated with "use strict" prefixed Fixes use case: var build = new Function('module', '"use strict";\n' + ); var bean = {exports:{}}; build.call(window, [bean]); bean = bean.exports; This use case is a minimal working example extracted from my custom module loader for the browser (think of yet another browserify). --- src/bean.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bean.js b/src/bean.js index 20b97c3..b7aba8f 100644 --- a/src/bean.js +++ b/src/bean.js @@ -1,7 +1,7 @@ (function (name, context, definition) { - if (typeof module != 'undefined' && module.exports) module.exports = definition() - else if (typeof define == 'function' && define.amd) define(definition) - else context[name] = definition() + if (typeof module != 'undefined' && module.exports) module.exports = definition(name, context) + else if (typeof define == 'function' && define.amd) define(function() { definition(name, context); }) + else context[name] = definition(name, context) })('bean', this, function (name, context) { name = name || 'bean' context = context || this @@ -733,4 +733,4 @@ setSelectorEngine() return bean -}); \ No newline at end of file +}); From f4e23edf33caab668a8a7b2e91745ec0b33c186b Mon Sep 17 00:00:00 2001 From: Vytautas Jakutis Date: Thu, 20 Mar 2014 12:16:20 +0000 Subject: [PATCH 2/3] rebuild --- bean.js | 8 ++++---- bean.min.js | 2 +- component.json | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bean.js b/bean.js index 78b74ae..d3fdf94 100644 --- a/bean.js +++ b/bean.js @@ -4,9 +4,9 @@ * MIT license */ (function (name, context, definition) { - if (typeof module != 'undefined' && module.exports) module.exports = definition() - else if (typeof define == 'function' && define.amd) define(definition) - else context[name] = definition() + if (typeof module != 'undefined' && module.exports) module.exports = definition(name, context) + else if (typeof define == 'function' && define.amd) define(function() { definition(name, context); }) + else context[name] = definition(name, context) })('bean', this, function (name, context) { name = name || 'bean' context = context || this @@ -738,4 +738,4 @@ setSelectorEngine() return bean -}); \ No newline at end of file +}); diff --git a/bean.min.js b/bean.min.js index 656e9dc..8dddc2b 100644 --- a/bean.min.js +++ b/bean.min.js @@ -3,4 +3,4 @@ * https://github.com/fat/bean * MIT license */ -(function(e,t,n){typeof module!="undefined"&&module.exports?module.exports=n():typeof define=="function"&&define.amd?define(n):t[e]=n()})("bean",this,function(e,t){e=e||"bean",t=t||this;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;n0){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].base);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;u0){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].base);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 Date: Thu, 20 Mar 2014 12:20:28 +0000 Subject: [PATCH 3/3] restore component.json --- component.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/component.json b/component.json index 40cbe71..ad62090 100644 --- a/component.json +++ b/component.json @@ -1,8 +1,8 @@ { - "name": "bean", - "description": "A small, fast, framework-agnostic event manager", - "version": "1.0.6", - "keywords": [ + "name": "bean" + , "description": "A small, fast, framework-agnostic event manager" + , "version": "1.0.5" + , "keywords": [ "ender", "events", "event", "dom" ] , "main": "bean.js" , "scripts": ["bean.js"] , "repo": "https://github.com/fat/bean"