Hi Tucker,
I have updated the code, but I have a few questions for you. When I refer
to 'current' I mean the existing code that is checked in. 'New' indicates
my changes:
Thanks!
Phil
==============================
LzNode.as
---------
1. I am using 'in' to prevent an undefined reference. Are there any
assumptions about the code I can make to eliminate using 'in'?
Current:
var c = arguments.callee.prototype.classChildren;
if ( c.length ){
New:
var c = ('classChildren' in arguments.callee.prototype) ?
arguments.callee.prototype.classChildren : null;
if ( 'length' in c ){
2. Same question as the previous item.
Current:
this.setClassEvents( arguments.callee );
New:
if ('setClassEvents' in this)
this.setClassEvents( arguments.callee );
3. I'm not sure about this one; maybe my notes are wrong. 'this.parent' is
initialized to null, but I get an error if I don't use 'in'
Current:
if ( this.parent.__LZpreventSubInit ){
New:
if ( ('parent' in this) && this.parent.__LZpreventSubInit ){
4. How far should I go with setAttribute? If I go all the way it looks like,
LzNode.prototype.setAttribute = function(prop, val) {
if ( !('prop' in this.setters) || null == this.setters[ prop ] ){
this[ prop ] = val;
var ev = 'on' + prop;
if (ev in this)
this[ev].sendEvent( val );
} else {
this[ this.setters[ prop ] ] ( val );
}
}
Should I remove the check on ev because DeclareEvent should/will be used
everywhere?
UserClass.as
------------
5. Can the conditional be simplified by using knowledge of the architecture?
Current:
if ( sup.prototype.classChildren.length ){
cc = sup.prototype.classChildren.concat();
} else{
cc = []
}
New:
if ( ('classChildren' in sup.prototype) && ('length' in
sup.prototype.classChildren) && (sup.prototype.classChildren.length) ){
cc = sup.prototype.classChildren.concat();
} else{
cc = []
}
LzDataElement.as
----------------
6. Is this right? Here's the new code (with the existing code as a comment
if (children == null) {
this.childNodes = []; // <-- Was: this.childNodes([]);
} else {
this.setChildNodes( children );
}
LzDataText.lzs
--------------
7. I added 'LzDataText.prototype.setters = {};' to the file because it isn't
defined for flash. Can I remove the identical line in the if ($dhtml) {}
block?
if ($dhtml) {
LzDataText.prototype.setAttribute = LzNode.prototype.setAttribute;
LzDataText.prototype.setters = {};
}
LzDataText.prototype.setters = {}; // <--- New line of code
LzDataText.prototype.setters.data = "setData";
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev