Skip to content

Commit

Permalink
Fixed bug related to live event binding and other small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Narendra Sisodiya committed Feb 8, 2015
1 parent abdad15 commit d4ffc1e
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 24 deletions.
8 changes: 8 additions & 0 deletions CHANGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ Latest Release
Older releases
=============

* 1.3.9 - on 8 Feb, 2015

Fixed bug on event binding and Live events

* 1.3.8 - on 4 Jan, 2015

Fixed bug : multiple subViews was not loading !

* 1.3.4 - on 1 Jan 2015

Now, Id will be generated automatically. You need now to pass id when loading any AppView or subView
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "choona.js",
"repo": "nsisodiya/choona.js",
"version": "1.3.8",
"version": "1.3.9",
"main": "dist/choona.js",
"keywords": [
"scalable",
Expand Down
32 changes: 21 additions & 11 deletions dist/choona.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* Copyright 2013-14 Narendra Sisodiya, <[email protected]>
* Copyright 2013-15 Narendra Sisodiya, <[email protected]>
* Licensed under "The MIT License". visit http://nsisodiya.mit-license.org/ to read the License.
* @author Narendra Sisodiya
*
* Version - 1.3.9
*/
;var choona = {};
(function() {
Expand All @@ -22,7 +22,7 @@
Child.prototype = Object.create(Parent.prototype);
Child.prototype.constructor = Child;
for (var i in ChildProto) {
if (ChildProto.hasOwnProperty(i)) {
if (ChildProto.hasOwnProperty(i) === true) {
Child.prototype[i] = ChildProto[i];
}
}
Expand Down Expand Up @@ -136,7 +136,7 @@
//Replacement for _.each over Objects
for: function(Obj, callback) {
for (var i in Obj) {
if (Obj.hasOwnProperty(i)) {
if (Obj.hasOwnProperty(i) === true) {
callback(Obj[i], i);
}
}
Expand Down Expand Up @@ -291,7 +291,7 @@
topicList: {},
subModuleList: {},
id: moduleConf.id,
eventsMap: [],
eventsMap: {},
mercykillFunc: null
};

Expand All @@ -308,7 +308,7 @@
}

//setup this.$el & this.$$ if jQuery present.
if (window.jQuery) {
if (window.jQuery !== undefined && typeof window.jQuery === "function") {
this.$el = this.$$ = window.jQuery(this.$);
}

Expand All @@ -328,7 +328,8 @@
* because, you need to get event bus for
* */

//Start Isolated EventBus , this will be useful for creating third party widget who do not want to create conflicts in naming
//Start Isolated EventBus , this will be useful for creating third party widget who do not want to create
// conflicts in naming
if (this.isolatedEventBus === true) {
this._viewMetadata.eventBus = new choona.EventBus();
}
Expand Down Expand Up @@ -434,10 +435,16 @@

var callback = function(e) {
if (hash === "") {
self[handler].call(self, e, e.target, e.target.dataset);
self[handler].call(self, e, e.currentTarget, e.currentTarget.dataset);
} else {
if (e.target.matches(hash)) {
self[handler].call(self, e, e.target, e.target.dataset);
var currNode;
currNode = e.target;
while (currNode !== e.currentTarget && currNode !== document) {
if (currNode.matches(hash) === true) {
self[handler].call(self, e, currNode, currNode.dataset);
break;
}
currNode = currNode.parentNode;
}
}
};
Expand Down Expand Up @@ -478,7 +485,7 @@
}

//unSubscribing All DOM events
this._viewMetadata.eventsMap.map(function(v, key) {
choona.Util.for(this._viewMetadata.eventsMap, function(v, key) {
self.off(key);
});

Expand All @@ -501,6 +508,9 @@
delete this._viewMetadata.topicList;
delete this._viewMetadata.eventsMap;
delete this._viewMetadata;
choona.Util.for(this, function(v, key) {
delete self[key];
});
}
});

Expand Down
2 changes: 1 addition & 1 deletion dist/choona.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/choona.Klass.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var choona = {};
Child.prototype = Object.create(Parent.prototype);
Child.prototype.constructor = Child;
for (var i in ChildProto) {
if (ChildProto.hasOwnProperty(i)) {
if (ChildProto.hasOwnProperty(i) === true) {
Child.prototype[i] = ChildProto[i];
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/choona.Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
//Replacement for _.each over Objects
for: function(Obj, callback) {
for (var i in Obj) {
if (Obj.hasOwnProperty(i)) {
if (Obj.hasOwnProperty(i) === true) {
callback(Obj[i], i);
}
}
Expand Down
24 changes: 17 additions & 7 deletions src/choona.View.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
topicList: {},
subModuleList: {},
id: moduleConf.id,
eventsMap: [],
eventsMap: {},
mercykillFunc: null
};

Expand All @@ -45,7 +45,7 @@
}

//setup this.$el & this.$$ if jQuery present.
if (window.jQuery) {
if (window.jQuery !== undefined && typeof window.jQuery === "function") {
this.$el = this.$$ = window.jQuery(this.$);
}

Expand All @@ -65,7 +65,8 @@
* because, you need to get event bus for
* */

//Start Isolated EventBus , this will be useful for creating third party widget who do not want to create conflicts in naming
//Start Isolated EventBus , this will be useful for creating third party widget who do not want to create
// conflicts in naming
if (this.isolatedEventBus === true) {
this._viewMetadata.eventBus = new choona.EventBus();
}
Expand Down Expand Up @@ -171,10 +172,16 @@

var callback = function(e) {
if (hash === "") {
self[handler].call(self, e, e.target, e.target.dataset);
self[handler].call(self, e, e.currentTarget, e.currentTarget.dataset);
} else {
if (e.target.matches(hash)) {
self[handler].call(self, e, e.target, e.target.dataset);
var currNode;
currNode = e.target;
while (currNode !== e.currentTarget && currNode !== document) {
if (currNode.matches(hash) === true) {
self[handler].call(self, e, currNode, currNode.dataset);
break;
}
currNode = currNode.parentNode;
}
}
};
Expand Down Expand Up @@ -215,7 +222,7 @@
}

//unSubscribing All DOM events
this._viewMetadata.eventsMap.map(function(v, key) {
choona.Util.for(this._viewMetadata.eventsMap, function(v, key) {
self.off(key);
});

Expand All @@ -238,6 +245,9 @@
delete this._viewMetadata.topicList;
delete this._viewMetadata.eventsMap;
delete this._viewMetadata;
choona.Util.for(this, function(v, key) {
delete self[key];
});
}
});

Expand Down
4 changes: 2 additions & 2 deletions src/headerNotice.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Copyright 2013-14 Narendra Sisodiya, <[email protected]>
* Copyright 2013-15 Narendra Sisodiya, <[email protected]>
* Licensed under "The MIT License". visit http://nsisodiya.mit-license.org/ to read the License.
* @author Narendra Sisodiya
*
* Version - 1.3.9
*/

0 comments on commit d4ffc1e

Please sign in to comment.