From 2f2c231557ad49d0feafded487ce23d4c3a693a8 Mon Sep 17 00:00:00 2001 From: sQu1rr Date: Tue, 8 Apr 2014 11:18:37 +0100 Subject: [PATCH 1/2] got rid of argument.callee using NFE --- src/extend.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/extend.js b/src/extend.js index 244be56..da7d6ec 100644 --- a/src/extend.js +++ b/src/extend.js @@ -22,7 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -(function(){ +(function(global){ + "use strict"; //Helper method for creating an super copied object clone function initialize(method){ //Recursivly execute parent methods. @@ -55,8 +56,8 @@ } //Create Class object - this.Class = function(){}; - Class.extend = function(to){ + global.Class = function(){}; + global.Class.extend = function ext(to){ function child(){ //Prevent the prototype scope set executing the constructor. if(initialize !== arguments[0]){ @@ -80,7 +81,6 @@ } //Allow the child to be extended. - var ext = arguments.callee; child.extend = function(target){ //Create parent referance and inherentence path. target.parent = to; @@ -90,5 +90,7 @@ return child } //Bootstrap Class by inheriting itself with empty constructor. - Class = Class.extend(function(){this.constructor=function(){}}); -})() \ No newline at end of file + global.Class = global.Class.extend(function() { + this.constructor=function(){} + }); +})(this) From f8345311096b436c867e42c5e01ffd75a816bcf9 Mon Sep 17 00:00:00 2001 From: Chris Benjaminsen Date: Sat, 19 Apr 2014 19:37:43 -0700 Subject: [PATCH 2/2] Merge to support NFE. --- bin/extend.js.license.txt | 2 +- bin/extend.min.js | 6 +++--- bower.json | 2 +- package.json | 2 +- src/extend.js | 4 ++-- tests/extend.min.js | 6 +++--- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bin/extend.js.license.txt b/bin/extend.js.license.txt index b4da389..5497c1e 100644 --- a/bin/extend.js.license.txt +++ b/bin/extend.js.license.txt @@ -1,7 +1,7 @@ ExtendJS More info at http://extendjs.org -Copyright (c) 2013 ChrisBenjaminsen.com +Copyright (c) 2013+ ChrisBenjaminsen.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/bin/extend.min.js b/bin/extend.min.js index 5f8c24e..d39966d 100644 --- a/bin/extend.min.js +++ b/bin/extend.min.js @@ -1,12 +1,12 @@ /* -ExtendJS 0.2.1 +ExtendJS 0.2.2 More info at http://extendjs.org -Copyright (c) 2013 ChrisBenjaminsen.com +Copyright (c) 2013+ ChrisBenjaminsen.com Distributed under the terms of the MIT license. http://extendjs.org/licence.txt This notice shall be included in all copies or substantial portions of the Software. */ -!function(){function t(r){r.parent instanceof Function&&(t.apply(this,[r.parent]),this.super=n(this,i(this,this.constructor))),r.apply(this,arguments)}function n(t,n){for(var r in t)"super"!==r&&t[r]instanceof Function&&(n[r]=t[r].super||i(t,t[r]));return n}function i(t,n){var i=t.super;return n.super=function(){return t.super=i,n.apply(t,arguments)}}this.Class=function(){},Class.extend=function(i){function r(){t!==arguments[0]&&(t.apply(this,[i]),n(this,this),this.initializer instanceof Function&&this.initializer.apply(this),this.constructor.apply(this,arguments))}r.prototype=new this(t),r.prototype.constructor=r,r.toString=function(){return""+i};var s=arguments.callee;return r.extend=function(t){return t.parent=i,s.apply(r,arguments)},r},Class=Class.extend(function(){this.constructor=function(){}})}() \ No newline at end of file +!function(a){"use strict";function b(a){a.parent instanceof Function&&(b.apply(this,[a.parent]),this.super=c(this,d(this,this.constructor))),a.apply(this,arguments)}function c(a,b){for(var c in a)"super"!==c&&a[c]instanceof Function&&(b[c]=a[c].super||d(a,a[c]));return b}function d(a,b){var c=a.super;return b.super=function(){return a.super=c,b.apply(a,arguments)}}a.Class=function(){},a.Class.extend=function e(a){function d(){b!==arguments[0]&&(b.apply(this,[a]),c(this,this),this.initializer instanceof Function&&this.initializer.apply(this),this.constructor.apply(this,arguments))}return d.prototype=new this(b),d.prototype.constructor=d,d.toString=function(){return a.toString()},d.extend=function(b){return b.parent=a,e.apply(d,arguments)},d},a.Class=a.Class.extend(function(){this.constructor=function(){}})}(this); diff --git a/bower.json b/bower.json index 8b4c9f6..043e5b5 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "extend.js", - "version": "0.2.1", + "version": "0.2.2", "main": [ "src/extend.js" ], diff --git a/package.json b/package.json index fa89712..b6011f1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "extend.js", - "version": "v0.2.1", + "version": "v0.2.2", "description": "ExtendJS extends JavaScript with a simple yet powerful class abstraction", "main": "src/extend.js", "repository": { diff --git a/src/extend.js b/src/extend.js index da7d6ec..6736a90 100644 --- a/src/extend.js +++ b/src/extend.js @@ -1,8 +1,8 @@ /* - ExtendJS 0.2.1 + ExtendJS 0.2.2 More info at http://extendjs.org - Copyright (c) 2013 ChrisBenjaminsen.com + Copyright (c) 2013+ ChrisBenjaminsen.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/tests/extend.min.js b/tests/extend.min.js index 5f8c24e..d39966d 100644 --- a/tests/extend.min.js +++ b/tests/extend.min.js @@ -1,12 +1,12 @@ /* -ExtendJS 0.2.1 +ExtendJS 0.2.2 More info at http://extendjs.org -Copyright (c) 2013 ChrisBenjaminsen.com +Copyright (c) 2013+ ChrisBenjaminsen.com Distributed under the terms of the MIT license. http://extendjs.org/licence.txt This notice shall be included in all copies or substantial portions of the Software. */ -!function(){function t(r){r.parent instanceof Function&&(t.apply(this,[r.parent]),this.super=n(this,i(this,this.constructor))),r.apply(this,arguments)}function n(t,n){for(var r in t)"super"!==r&&t[r]instanceof Function&&(n[r]=t[r].super||i(t,t[r]));return n}function i(t,n){var i=t.super;return n.super=function(){return t.super=i,n.apply(t,arguments)}}this.Class=function(){},Class.extend=function(i){function r(){t!==arguments[0]&&(t.apply(this,[i]),n(this,this),this.initializer instanceof Function&&this.initializer.apply(this),this.constructor.apply(this,arguments))}r.prototype=new this(t),r.prototype.constructor=r,r.toString=function(){return""+i};var s=arguments.callee;return r.extend=function(t){return t.parent=i,s.apply(r,arguments)},r},Class=Class.extend(function(){this.constructor=function(){}})}() \ No newline at end of file +!function(a){"use strict";function b(a){a.parent instanceof Function&&(b.apply(this,[a.parent]),this.super=c(this,d(this,this.constructor))),a.apply(this,arguments)}function c(a,b){for(var c in a)"super"!==c&&a[c]instanceof Function&&(b[c]=a[c].super||d(a,a[c]));return b}function d(a,b){var c=a.super;return b.super=function(){return a.super=c,b.apply(a,arguments)}}a.Class=function(){},a.Class.extend=function e(a){function d(){b!==arguments[0]&&(b.apply(this,[a]),c(this,this),this.initializer instanceof Function&&this.initializer.apply(this),this.constructor.apply(this,arguments))}return d.prototype=new this(b),d.prototype.constructor=d,d.toString=function(){return a.toString()},d.extend=function(b){return b.parent=a,e.apply(d,arguments)},d},a.Class=a.Class.extend(function(){this.constructor=function(){}})}(this);