I'm successfully porting YUI http://developer.yahoo.com/yui/ widgets to java2script. I hope soon to have something working to publish. Nevertheless I step with the following problem..
I have accomplished to, with a relatively automatized "procedure", starting the porting of YAHOO.widget "classes" to java2script. However, when doing some testing with YAHOO.widget.Datatable (file:///home/sebastian/desarrollo/sgurin_workspace/yui/datatabletext.html) I encounter that YUI code fails if j2slib/j2slib.z was included in the html page.
I commented j2slib/java/lang/ClassExt.js code that "contaminates" Object.prototype and voila! the widget WORKED in conjunction with java2script without problems:
/*
* Invade the Object prototype!
* TODO: make sure that invading Object prototype does not affect other
* existed library, such as Dojo, YUI, Prototype, ...
*/
....
Object.getName = Clazz.innerFunctions.getName;
Object.prototype.equals = function (obj) {
return this == obj;
};
......
In this particular case, the fault was of Object.prototype.toString overriding:
Object.prototype.toString=function(){
if(this.__CLASS_NAME__!=null) {
return "["+this.__CLASS_NAME__+" object]";}else{return"[object]";
}
};
If I comment the last code, YUI datatable widget works fine with java2script!! :))).
Well, I'm not sure is this is a real bug, so I'm sending this mail to discuss it.
Hope I had explained myself correctly.
--
Sebastian Gurin <sgu...@softpoint.org>
Hi all.
I'm successfully porting YUI http://developer.yahoo.com/yui/ widgets to java2script. I hope soon to have something working to publish. Nevertheless I step with the following problem..
I have accomplished to, with a relatively automatized "procedure", starting the porting of YAHOO.widget "classes" to java2script. However, when doing some testing with YAHOO.widget.Datatable (file:///home/sebastian/desarrollo/sgurin_workspace/yui/datatabletext.html) I encounter that YUI code fails if j2slib/j2slib.z was included in the html page.
I commented j2slib/java/lang/ClassExt.js code that "contaminates" Object.prototype and voila! the widget WORKED in conjunction with java2script without problems:
/*
* Invade the Object prototype!
* TODO: make sure that invading Object prototype does not affect other
* existed library, such as Dojo, YUI, Prototype, ...
*/
....
Object.getName = Clazz.innerFunctions.getName;
Object.prototype.equals = function (obj) {
return this == obj;
};
......
In this particular case, the fault was of Object.prototype.toString overriding:
Object.prototype.toString=function(){
if(this.__CLASS_NAME__!=null) {
return "["+this.__CLASS_NAME__+" object]";}else{return"[object]";
}
};
If I comment the last code, YUI datatable widget works fine with java2script!! :))).
Well, I'm not sure is this is a real bug, so I'm sending this mail to discuss it.
Hope I had explained myself correctly.
--
Sebastian Gurin <sgu...@softpoint.org>
BTW, Are this kind of bugs solved in some branch/trunk svn module? (i.e. from what svn url should I download the patched j2slib? - sorry i'm new with svn...)
thanks in advance. I will let you know when I reach to a decent yui widget porting to java2script... It is looking good ....
On Wed, 24 Jun 2009 09:30:31 +0800
Zhou Renjian <zhour...@gmail.com> wrote:
> Object.prototype.to$tring = Object.prototype.toString;
> Object.prototype.toString = function () {
> if (this.__CLASS_NAME__! = null) {
> return "[" + this.__CLASS_NAME__ + " object]";
> } else {
> return this.to$tring ();
> }
> };
--
Sebastian Gurin <sgu...@softpoint.org>