Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[BUG #4983] Added init method for modules.

  • Loading branch information...
commit 090723d93198f58e68bdbc8a88320aa0f2c20771 1 parent 75944c4
@wittemann wittemann authored
View
17 framework/source/class/q.js
@@ -3,11 +3,18 @@ qx.Bootstrap.define("q", {});
(function() {
q = function(selector, context) {
- var arr = qx.bom.Selector.query(selector, context);
- var col = qx.lang.Array.cast(arr, qx.Collection);
+ return q.init(qx.bom.Selector.query(selector, context));
+ }
+
+ q.__init = [];
+ q.init = function(arg) {
+ var col = qx.lang.Array.cast(arg, qx.Collection);
+ for (var i=0; i < q.__init.length; i++) {
+ q.__init[i].call(col);
+ };
return col;
- }
+ };
q.attach = function(module) {
for (var name in module) {
@@ -30,4 +37,8 @@ qx.Bootstrap.define("q", {});
q[name] = module[name];
}
}
+
+ q.attachInit = function(init) {
+ this.__init.push(init);
+ }
})();
View
6 framework/source/class/qx/module/Animation.js
@@ -7,6 +7,10 @@
qx.Bootstrap.define("qx.module.Animation", {
statics :
{
+ init : function() {
+ this.__animationHandles = [];
+ },
+
_fadeOut : {duration: 700, timing: "ease-out", keyFrames : {
0: {opacity: 1},
100: {opacity: 0}
@@ -80,5 +84,7 @@ qx.Bootstrap.define("qx.module.Animation", {
"fadeIn" : statics.fadeIn,
"fadeOut" : statics.fadeOut
});
+
+ q.attachInit(statics.init);
}
});
View
7 framework/source/class/qx/module/Manipulating.js
@@ -2,8 +2,7 @@ qx.Bootstrap.define("qx.module.Manipulating", {
statics :
{
create : function(html) {
- var arr = qx.bom.Html.clean([html]);
- return qx.lang.Array.cast(arr, qx.Collection);
+ return q.init(qx.bom.Html.clean([html]));
},
@@ -11,14 +10,14 @@ qx.Bootstrap.define("qx.module.Manipulating", {
if (!qx.lang.Type.isArray(el)) {
el = [el];
}
- return qx.lang.Array.cast(el, qx.Collection);
+ return q.init(el);
},
append : function(html) {
var arr = qx.bom.Html.clean([html]);
var children = qx.lang.Array.cast(arr, qx.Collection);
-
+
for (var i=0, l=this.length; i < l; i++) {
for (var j=0, m=children.length; j < m; j++) {
if (i == 0) {
Please sign in to comment.
Something went wrong with that request. Please try again.