Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix spaces

  • Loading branch information...
commit 5c8f1a7ef283c85c5d590703cd9a75113a13c7e2 1 parent ee9dc92
Rubén Medellín authored
View
9 lib/neon.js
@@ -36,8 +36,8 @@
* Class('Overlay').inherits(Widget).ensures(Editable).includes(Composition, Other)({
* html : '<div></div>',
* prototype : {
- * init : function (element){
- * if(!element){
+ * init : function (element) {
+ * if(!element) {
* element = document.createElement('div');
* element.innerHTML = 'hello';
* document.body.appendChild(element);
@@ -104,7 +104,7 @@
};
- factory = function(definition){
+ factory = function(definition) {
var property;
newModule.isModule = true;
@@ -134,7 +134,7 @@
};
factory.includes = function () {
- for(var i = 0; i < arguments.length; i++){
+ for(var i = 0; i < arguments.length; i++) {
newModule.include(arguments[i]);
}
return factory;
@@ -159,6 +159,7 @@
newClass.__implementedInterfaces = [];
newClass.__includedModules = [];
newClass.className = className;
+
newClass.include = function(module) {
var property;
for (property in module) {
View
2  lib/stdlib/bubbling_support.js
@@ -1,4 +1,4 @@
-if(typeof exports !== 'undefined'){
+if(typeof exports !== 'undefined') {
// assume we are in Node
var Module = require('../neon.js').Module;
var CustomEventSupport = require('./custom_event_support.js').CustomEventSupport;
View
6 lib/stdlib/custom_event.js
@@ -1,4 +1,4 @@
-if(typeof exports !== 'undefined'){
+if(typeof exports !== 'undefined') {
// assume we are in Node
var Class = require('../neon.js').Class;
}
@@ -19,7 +19,7 @@ if(typeof exports !== 'undefined'){
init : function init(type, data) {
this.type = type;
if (typeof data !== 'undefined') {
- for(var property in data){
+ for(var property in data) {
if (data.hasOwnProperty(property)) {
this[property] = data[property];
}
@@ -47,7 +47,7 @@ if(typeof exports !== 'undefined'){
return CustomEvent;
});
} else {
- global.CustomEvent= CustomEvent;
+ global.CustomEvent = CustomEvent;
}
}(typeof window !== 'undefined' ? window : (typeof exports !== 'undefined' ? exports : null)));
View
68 lib/stdlib/custom_event_support.js
@@ -1,67 +1,72 @@
-if(typeof exports !== 'undefined'){
+if(typeof exports !== 'undefined') {
// assume we are in Node
var Module = require('../neon.js').Module;
var CustomEvent = require('./custom_event.js').CustomEvent;
}
(function(global) {
+
CustomEventSupport = Module('CustomEventSupport')({
+
eventListeners : null,
- bind : function(type, eventHandler){
+
+ bind : function(type, eventHandler) {
var found, i, listeners;
- if(!this.eventListeners){
+ if(!this.eventListeners) {
this.eventListeners = {};
}
- if(!this.eventListeners[type]){
+ if(!this.eventListeners[type]) {
this.eventListeners[type] = [];
}
found = false;
listeners = this.eventListeners[type];
- for (i = 0; i < listeners.length; i++){
- if (listeners[i] === eventHandler) {
- found = true;
- break;
- }
+ for (i = 0; i < listeners.length; i++) {
+ if (listeners[i] === eventHandler) {
+ found = true;
+ break;
+ }
}
- if(!found){
+ if(!found) {
this.eventListeners[type].push(eventHandler);
}
return this;
},
- unbind : function(type, eventHandler){
+
+ unbind : function(type, eventHandler) {
var i, found, listeners;
found = false;
- if(!this.eventListeners){
+ if(!this.eventListeners) {
this.eventListeners = {};
}
- if(typeof eventHandler == 'undefined'){
+ if(typeof eventHandler == 'undefined') {
this.eventListeners[type] = [];
}
listeners = this.eventListeners[type];
for (i = 0; i < listeners.length; i++) {
- if(listeners[i] === eventHandler){
+ if(listeners[i] === eventHandler) {
found = true;
break;
}
}
- if(found){
+ if(found) {
this.eventListeners[type].splice(i, 1);
}
return this;
},
- dispatch : function(type, data){
+
+ dispatch : function(type, data) {
var event, listeners, instance, i;
if (this.eventListeners === null) {
@@ -89,16 +94,19 @@ if(typeof exports !== 'undefined'){
return event;
},
+
prototype : {
+
eventListeners : null,
- bind : function(type, eventHandler){
+
+ bind : function(type, eventHandler) {
var found, i, listeners;
- if(!this.eventListeners){
+ if(!this.eventListeners) {
this.eventListeners = {};
}
- if(!this.eventListeners[type]){
+ if(!this.eventListeners[type]) {
this.eventListeners[type] = [];
}
@@ -106,47 +114,49 @@ if(typeof exports !== 'undefined'){
listeners = this.eventListeners[type];
for (i = 0; i < listeners.length; i++) {
- if(listeners[i] === eventHandler){
+ if(listeners[i] === eventHandler) {
found = true;
break;
}
}
- if(!found){
+ if(!found) {
this.eventListeners[type].push(eventHandler);
}
return this;
},
- unbind : function(type, eventHandler){
+
+ unbind : function(type, eventHandler) {
var i, found, listeners;
- found = false;
- i = 0;
+ found = false;
+ i = 0;
- if(!this.eventListeners){
+ if(!this.eventListeners) {
this.eventListeners = {};
}
- if(typeof eventHandler == 'undefined'){
+ if(typeof eventHandler == 'undefined') {
this.eventListeners[type] = [];
}
listeners = this.eventListeners[type];
for (i = 0; i < listeners.length; i++) {
- if(listeners[i] == eventHandler){
+ if(listeners[i] == eventHandler) {
found = true;
break;
}
}
- if(found){
+ if(found) {
this.eventListeners[type].splice(i, 1);
}
return this;
},
- dispatch : function(type, data){
+
+ dispatch : function(type, data) {
var event, listeners, instance, i;
if (this.eventListeners === null) {
View
10 lib/stdlib/node_support.js
@@ -1,4 +1,4 @@
-if(typeof exports !== 'undefined'){
+if(typeof exports !== 'undefined') {
// assume we are in Node
var Module = require('../neon.js').Module;
}
@@ -10,12 +10,12 @@ if(typeof exports !== 'undefined'){
children : [],
- appendChild : function(child){
- if(child.parent){
+ appendChild : function(child) {
+ if(child.parent) {
child.parent.removeChild(child);
}
- if(!this.hasOwnProperty('children')){
+ if(!this.hasOwnProperty('children')) {
this.children = [];
}
@@ -50,7 +50,7 @@ if(typeof exports !== 'undefined'){
},
- insertChild : function(child, position){
+ insertChild : function(child, position) {
console.warn('NodeSupport insertChild method is deprecated, try insertBefore');
if (child.parent) {
Please sign in to comment.
Something went wrong with that request. Please try again.