summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/extended/base.js
diff options
context:
space:
mode:
authorxue <>2006-04-21 12:36:06 +0000
committerxue <>2006-04-21 12:36:06 +0000
commite392ecbf6e422825083bc7204eacb7090619a47c (patch)
tree8f2dcc8302f223ac2c71efd762417eddf84d62aa /framework/Web/Javascripts/extended/base.js
parentc54a230a5926086ff1b69a0dd7e6352dbc0b40ff (diff)
Merge from 3.0 branch till 953.
Diffstat (limited to 'framework/Web/Javascripts/extended/base.js')
-rw-r--r--framework/Web/Javascripts/extended/base.js43
1 files changed, 23 insertions, 20 deletions
diff --git a/framework/Web/Javascripts/extended/base.js b/framework/Web/Javascripts/extended/base.js
index 06a916d6..53856684 100644
--- a/framework/Web/Javascripts/extended/base.js
+++ b/framework/Web/Javascripts/extended/base.js
@@ -1,26 +1,29 @@
-/**
- * get element
- @ @param element or element id string
- @ returns element
+/**
+ * Similar to bindAsEventLister, but takes additional arguments.
*/
-function $(n,d) {
- if(isElement(n)) return n;
- if(isString(n)==false) return null;
- var p,i,x;
- if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
- d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
- if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
- for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=DOM.find(n,d.layers[i].document);
- if(!x && d.getElementById) x=d.getElementById(n); return x;
+Function.prototype.bindEvent = function()
+{
+ var __method = this, args = $A(arguments), object = args.shift();
+ return function(event)
+ {
+ return __method.apply(object, [event || window.event].concat(args));
+ }
}
/**
- * Similar to bindAsEventLister, but takes additional arguments.
+ * Creates a new function by copying function definition from
+ * the <tt>base</tt> and optional <tt>definition</tt>.
+ * @param function a base function to copy from.
+ * @param array additional definition
+ * @param function return a new function with definition from both
+ * <tt>base</tt> and <tt>definition</tt>.
*/
-Function.prototype.bindEvent = function() {
- var __method = this, args = $A(arguments), object = args.shift();
- return function(event) {
- return __method.apply(object, [event || window.event].concat(args));
- }
-}
+Class.extend = function(base, definition)
+{
+ var component = Class.create();
+ Object.extend(component.prototype, base.prototype);
+ if(definition)
+ Object.extend(component.prototype, definition);
+ return component;
+} \ No newline at end of file