Author: nbelaevski
Date: 2010-07-19 07:25:43 -0400 (Mon, 19 Jul 2010)
New Revision: 18143
Modified:
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
root/core/trunk/impl/src/test/resources/javascript/richfaces-base-component-qunit.js
Log:
BaseComponent function updated
Modified:
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
===================================================================
---
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2010-07-18
21:46:19 UTC (rev 18142)
+++
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2010-07-19
11:25:43 UTC (rev 18143)
@@ -54,16 +54,7 @@
var $p = {};
- /**
- * Method extends child class prototype with parent prototype
- * and return the object with parent's protected methods
- *
- * @function
- * @name RichFaces.BaseComponent.extend
- *
- * @return {object}
- * */
- richfaces.BaseComponent.extend = function (parent, child, h) {
+ var extend = function (parent, child, h) {
h = h || {};
var F = richfaces.blankFunction;
F.prototype = parent.prototype;
@@ -74,15 +65,30 @@
var r = jQuery.extend({}, $p, h||{});
}
+ var _parent = child;
+
// create wrapper with protected methods and variables
- child.extend = function (_parent, _child, _h) {
+ child.extend = function (_child, _h) {
_h = _h || {};
var _r = jQuery.extend({}, r||h||{}, _h||{});
- return richfaces.BaseComponent.extend(_parent, _child, _r);
+ return extend(_parent, _child, _r);
}
return r||h;
};
+ /**
+ * Method extends child class prototype with parent prototype
+ * and return the object with parent's protected methods
+ *
+ * @function
+ * @name RichFaces.BaseComponent.extend
+ *
+ * @return {object}
+ * */
+ richfaces.BaseComponent.extend = function(child, h) {
+ return extend(richfaces.BaseComponent, child, h);
+ };
+
$.extend(richfaces.BaseComponent.prototype, (function (params) {
return {
/**
Modified:
root/core/trunk/impl/src/test/resources/javascript/richfaces-base-component-qunit.js
===================================================================
---
root/core/trunk/impl/src/test/resources/javascript/richfaces-base-component-qunit.js 2010-07-18
21:46:19 UTC (rev 18142)
+++
root/core/trunk/impl/src/test/resources/javascript/richfaces-base-component-qunit.js 2010-07-19
11:25:43 UTC (rev 18143)
@@ -7,7 +7,7 @@
};
var $p ={a:function(){return "hello"}};
- $p = richfaces.BaseComponent.extend(richfaces.BaseComponent, MyComponent, $p);
+ $p = richfaces.BaseComponent.extend(MyComponent, $p);
var $super = MyComponent.$super;
jQuery.extend(MyComponent.prototype, (function () {
@@ -45,7 +45,7 @@
$super.constructor.call(this, componentId);
};
var $p = {b:"b"};
- $p = MyComponent.extend(MyComponent, MyComponent2, $p);
+ $p = MyComponent.extend(MyComponent2, $p);
equals(typeof $p.a, "function", "ComponentCreation: inherit protected
method from MyComponent2");
var $super = MyComponent2.$super;
jQuery.extend(MyComponent2.prototype, (function () {
@@ -68,7 +68,7 @@
$super.constructor.call(this, componentId);
};
var $p = {c:"c"};
- $p = MyComponent2.extend(MyComponent2, MyComponent3, $p);
+ $p = MyComponent2.extend(MyComponent3, $p);
equals(typeof $p.a, "function", "ComponentCreation: inherit protected
method from MyComponent2");
equals(typeof $p.b, "string", "ComponentCreation: inherit static
protected property from MyComponent3");
var $super = MyComponent3.$super;