[Laszlo-checkins] r13688 - openlaszlo/trunk/WEB-INF/lps/lfc/data

bargull@openlaszlo.org bargull at openlaszlo.org
Wed Apr 15 11:20:58 PDT 2009


Author: bargull
Date: 2009-04-15 11:20:53 -0700 (Wed, 15 Apr 2009)
New Revision: 13688

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataNode.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataText.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataset.lzs
Log:
Change 20090415-bargull-K1E by bargull at dell--p4--2-53 on 2009-04-15 15:31:31
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: more lfc-data updates

New Features:

Bugs Fixed: LPP-8057 (still some minor update for lfc-data possible)

Technical Reviewer: hminsky
QA Reviewer: (pending)
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
LzDataNode:
- added typing to dependencies methods (getPreviousSibling, getNextSibling)
- removed optional parameter from serialize() (not an official and approved public API change, added in r8736 only to avoid swf9-runtime error; and not properly implemented see e.g. LzDataText) 
- use identity comparison in childOfNode()

LzDataElement:
- added more missing typing (LPP-7637 can be ignored in this case, unlikely anyone will subclass from LzDataElement)
- childNodes is never `null` therefore the null-check in appendChild() can be removed
- enforce string-coercion in "attributes"-setter for consistency with setAttr()
- remove null-check for ownerDocument in "attributes"-setter, it should never be null
- general: use local variable for array-length when iterating over arrays 
- copy "attributes"-object (by calling setter) in LzDataElement constructor to avoid possible data inconsistency when users change manually object after creating LzDataElement instance
- require that both childNodes and attributes are non-null in constructor

LzDataText:
- remove unused, poorly documented "length" property

LzDataset:
- replace calls to Function#apply(), see LPP-8016
- require that both childNodes and attributes are non-null in construct()
    

Tests:
(smokecheck, alldata) x (swf8, swf9, dhtml)



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs	2009-04-15 18:15:04 UTC (rev 13687)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs	2009-04-15 18:20:53 UTC (rev 13688)
@@ -14,6 +14,8 @@
   * @access public
   *
   * @devnote W3C-DOM Element interface: http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-745549614
+  *
+  * @devnote uncomment typing when LPP-5840 is implemented
   */
 mixin LzDataElementMixin {
     // N.B.: LzDataElementMixin may or may not be an LzNode, so
@@ -41,7 +43,7 @@
   * @param LzDataNodeMixin refChild: the LzDataNodeMixin to insert newChild before
   * @return LzDataNodeMixin: The new child, or null if the refChild wasn't found
   */
-public function insertBefore (newChild, refChild){
+public function insertBefore (newChild /*:LzDataNodeMixin*/, refChild /*:LzDataNodeMixin*/) :LzDataNodeMixin {
     if (newChild == null) {
         return null;
     } else if (refChild == null) {
@@ -90,7 +92,7 @@
   * @return LzDataNodeMixin: The new child, or null if the oldChild wasn't found
   * @dev-note: DOM-Spec (Level2, Level3) says we need to return the oldChild instead of the newChild
   */
-public function replaceChild (newChild, oldChild){
+public function replaceChild (newChild /*:LzDataNodeMixin*/, oldChild /*:LzDataNodeMixin*/) :LzDataNodeMixin {
     if (newChild == null) {
         return null;
     } /* else if (newChild === this) {
@@ -140,7 +142,7 @@
   * @param LzDataNodeMixin oldChild: The LzDataNodeMixin to remove
   * @return LzDataNodeMixin: The removed child, or null if the oldChild was not found
   */
-public function removeChild (oldChild){
+public function removeChild (oldChild /*:LzDataNodeMixin*/) :LzDataNodeMixin {
     var off:int = this.__LZgetCO(oldChild);
     if (off >= 0) {
         // @devnote parentNode needs to be set to null, but that breaks smoke-check.
@@ -167,7 +169,7 @@
   * @param LzDataNodeMixin newChild: The LzDataNodeMixin to add.
   * @return LzDataNodeMixin: The newChild.
   */
-public function appendChild (newChild){
+public function appendChild (newChild /*:LzDataNodeMixin*/) :LzDataNodeMixin {
     if (newChild == null) {
         return null;
     } /* else if (newChild === this) {
@@ -183,12 +185,7 @@
             }
         }
 
-        if (this.childNodes) {
-            this.childNodes.push( newChild );
-        } else {
-            this.childNodes = [newChild];
-        }
-
+        this.childNodes.push( newChild );
         //instead of marking dirty, this is easy
         newChild.__LZo = this.childNodes.length - 1;
 
@@ -213,13 +210,16 @@
 /**
   * @access private
   */
-override public function cloneNode ( deep:Boolean = false ) :LzDataNodeMixin {
-    var n:LzDataElement = new LzDataElement(this.nodeName);
-    n.$lzc$set_attributes( this.attributes );
-    if ( deep ){
-        for ( var i:int = 0; i < this.childNodes.length; i++ ){
-            n.appendChild( this.childNodes[ i ].cloneNode( true ) );
+override public function cloneNode (deep:Boolean = false) :LzDataNodeMixin {
+    var n:LzDataElement = new LzDataElement(this.nodeName, this.attributes);
+    if (deep) {
+        var cn:Array = this.childNodes;
+        var copy:Array = [];
+        for (var i:int = cn.length - 1; i >= 0; --i) {
+            copy[i] = cn[i].cloneNode(true);
         }
+        // TODO: [20090414 anba] slow because of multiple ownerDocument changes
+        n.$lzc$set_childNodes(copy);
     }
 
     return n;
@@ -231,8 +231,7 @@
   * @return String: The value for the given attribute
   */
 public function getAttr (name:String) :String {
-    if (this.attributes) return this.attributes[ name ];
-    return null;
+    return this.attributes[ name ];
 }
 /** @access private */
 function $lzc$getAttr_dependencies (who , self) :Array {
@@ -251,9 +250,6 @@
     } else {
       value = String(value);
     }
-    if ( ! this.attributes ) {
-      this.attributes = {};
-    }
     this.attributes[ name ] = value;
     if (this.onattributes.ready) this.onattributes.sendEvent( name );
     this.ownerDocument.handleDocumentChange( "attributes" , this, 1, {name: name, value: value, type: 'set'});
@@ -283,7 +279,7 @@
   *This method returns a Attr object.
   *The newAttr parameter is a Attr object.
   */
-//function setAttrNode (newAttr){
+//function setAttributeNode (newAttr){
 //}
 
 /**
@@ -295,7 +291,7 @@
     return this.attributes[ name ] != null;
 }
 /** @access private */
-function $lzc$hasAttr_dependencies (who , self) :Array {
+function $lzc$hasAttr_dependencies (who:*, self:*) :Array {
     return [ self, 'attributes' ];
 }
 
@@ -303,11 +299,11 @@
   * Returns the first child of this node.
   * @return LzDataNodeMixin: The first child of this node
   */
-public function getFirstChild (){
+public function getFirstChild () :LzDataNodeMixin {
     return this.childNodes[ 0 ];
 }
 /** @access private */
-function $lzc$getFirstChild_dependencies( who, self ) :Array {
+function $lzc$getFirstChild_dependencies (who:*, self:*) :Array {
     return [ this, "childNodes" ];
 }
 
@@ -315,11 +311,11 @@
   * Returns the last child of this node.
   * @return LzDataNodeMixin: The last child of this node
   */
-public function getLastChild (){
+public function getLastChild () :LzDataNodeMixin {
     return this.childNodes[ this.childNodes.length-1 ];
 }
 /** @access private */
-function $lzc$getLastChild_dependencies( who, self ) :Array {
+function $lzc$getLastChild_dependencies (who:*, self:*) :Array {
     return [ this, "childNodes" ];
 }
 
@@ -351,7 +347,7 @@
   * - setting ownerDocument to null 
   * @access private
   */
-function __LZremoveChild (oldChild /*:LzDataNodeMixin*/ ) :void {
+function __LZremoveChild (oldChild /*:LzDataNodeMixin*/) :void {
     var off:int = this.__LZgetCO(oldChild);
     if (off >= 0) {
         this.childNodes.splice(off, 1);
@@ -363,7 +359,7 @@
   */
 function __LZupdateCO () :void {
     var cn:Array = this.childNodes;
-    for ( var i:int = 0; i < cn.length; i++ ){
+    for (var i:int = 0, len:int = cn.length; i < len; i++) {
         cn[ i ].__LZo = i;
     }
     this.__LZcoDirty = false;
@@ -372,13 +368,15 @@
 /** @access private */
 function $lzc$set_attributes (attrs:Object) :void {
     var a:Object = {};
-    for (var k:String in attrs) { a[ k ] = attrs[ k ]; }
+    // Enforce string coercion. This is consistent with other DOM's which
+    // only permit string attributes.
+    for (var k:String in attrs) {
+        a[ k ] = String(attrs[ k ]);
+    }
 
     this.attributes = a;
     if (this.onattributes.ready) this.onattributes.sendEvent( a );
-    if (this.ownerDocument) {
-        this.ownerDocument.handleDocumentChange( "attributes", this, 1);
-    }
+    this.ownerDocument.handleDocumentChange( "attributes", this, 1);
 }
 
 /**
@@ -478,9 +476,10 @@
   */
 function __LZgetText () :String {
     var s:String = "";
-    for ( var i:int = 0; i < this.childNodes.length; i++ ){
-        var c = this.childNodes[ i ];
-        if ( c.nodeType == LzDataElement.TEXT_NODE ){
+    var cn:Array = this.childNodes;
+    for (var i:int = 0, len:int = cn.length; i < len; i++ ){
+        var c /*:LzDataNodeMixin*/ = cn[ i ];
+        if (c.nodeType == LzDataElement.TEXT_NODE) {
             s += c.data;
         }
     }
@@ -494,9 +493,10 @@
   */
 public function getElementsByTagName (name:String) :Array {
     var r:Array = [];
-    for ( var i:int = 0; i < this.childNodes.length; i++ ){
-        if ( this.childNodes[i].nodeName == name ){
-            r.push( this.childNodes[ i ] );
+    var cn:Array = this.childNodes;
+    for (var i:int = 0, len:int = cn.length; i < len; i++) {
+        if (cn[i].nodeName == name) {
+            r.push( cn[ i ] );
         }
     }
     return r;
@@ -562,8 +562,8 @@
 /**
   * @access private
   */
-override public function serialize (len:Number = Infinity) :String {
-    return this.serializeInternal(len);
+override public function serialize () :String {
+    return this.serializeInternal();
 }
 
 /**
@@ -573,16 +573,17 @@
 function serializeInternal (len:Number = Infinity) :String {
     var s:String = this.__LZlt + this.nodeName;
 
-    //Debug.info('k', this.attributes);
-    for ( var k:String in this.attributes ){
-        s += " " + k + '="' + LzDataElement.__LZXMLescape( this.attributes[ k ] ) + '"';
+    var attrs:Object = this.attributes;
+    for (var k:String in attrs) {
+        s += " " + k + '="' + LzDataElement.__LZXMLescape( attrs[ k ] ) + '"';
         if (s.length > len) { break; }
     }
 
-    if ( s.length <= len && this.childNodes && this.childNodes.length ){
+    var cn:Array = this.childNodes;
+    if (s.length <= len && cn.length) {
         s += this.__LZgt;
-        for ( var i:int = 0; i < this.childNodes.length; i++ ){
-            s += this.childNodes[ i ].serialize(len);
+        for (var i:int = 0, cnlen:int = cn.length; i < cnlen; i++) {
+            s += cn[ i ].serialize();
             if (s.length > len) { break; }
         }
         s += this.__LZlt + "/" + this.nodeName + this.__LZgt;
@@ -617,10 +618,10 @@
   * @param LzDataNodeMixin who: The node that changed.
   * @param Number type: private
   */
-public function handleDocumentChange ( what:String, who /*:LzDataNodeMixin*/, type:int, cobj:Object? = null ) :void {
+public function handleDocumentChange (what:String, who /*:LzDataNodeMixin*/, type:int, cobj:Object? = null) :void {
     var o:Object = {who: who, what: what, type: type};
     if (cobj) o.cobj = cobj;
-    if ( this.__LZchangeQ ){
+    if (this.__LZchangeQ) {
         this.__LZchangeQ.push( o );
     } else {
         if (this.onDocumentChange.ready) this.onDocumentChange.sendEvent( o );
@@ -635,23 +636,24 @@
 }
 
 /**
-  * @dev-note: public for swf9, but still doc-private!
+  * @dev-note This function needs to be declared as public so it'll be emitted
+  * as part of the LzDataElementMixin interface in AS3.
   * @access private
   */
-public function __LZdoLock ( locker:LzDatapath ) :void {
-    if ( !this.__LZchangeQ ){
+public function __LZdoLock (locker:LzDatapath) :void {
+    if (! this.__LZchangeQ) {
         this.__LZchangeQ = [];
         this.__LZlocker = locker;
     }
 }
 
 /**
-  * @dev-note: public for swf9, but still doc-private!
+  * @dev-note This function needs to be declared as public so it'll be emitted
+  * as part of the LzDataElementMixin interface in AS3.
   * @access private
   */
-public function __LZdoUnlock ( locker:LzDatapath ) :void {
-
-    if ( this.__LZlocker != locker ){
+public function __LZdoUnlock (locker:LzDatapath) :void {
+    if (this.__LZlocker != locker) {
         return;
     }
 
@@ -660,20 +662,20 @@
     this.__LZlocker = null;
 
     if (lzq != null) {
-        for ( var i:int = 0; i < lzq.length; i++ ){
+        for (var i:int = 0, len:int = lzq.length; i < len; i++) {
             var sendit:Boolean = true;
             var tc:Object = lzq[ i ];
-            for ( var j:int = 0; j < i; j++ ){
+            for (var j:int = 0; j < i; j++) {
                 var oc:Object = lzq[ j ];
-                if ( tc.who == oc.who &&
+                if (tc.who == oc.who &&
                      tc.what == oc.what &&
-                     tc.type == oc.type ){
+                     tc.type == oc.type) {
                     sendit = false;
                     break;
                 }
             }
 
-            if ( sendit ){
+            if (sendit) {
                 this.handleDocumentChange( tc.what, tc.who, tc.type );
             }
         }
@@ -697,21 +699,30 @@
   * @access public
   */
 class LzDataElement extends LzDataNode with LzDataElementMixin, LzDataNodeMixin {
-    /** DEFINE OBJECT: LzDataElement
+    /**
      * This object represents a hierarchical data node.
      * @param String name: The name for this node.
      * @param Object attributes: A optional dictionary of attributes for this node.
-     * @param [LzDataNode] children: An optional array of children for this node
+     * @param [LzDataNodeMixin] children: An optional array of children for this node
      */
-    function LzDataElement ( name:String, attributes:Object? = null, children:Array? = null) {
+    function LzDataElement (name:String, attributes:Object? = null, children:Array? = null) {
         // N.B.: LzDataElement is not an LzNode so has a different
         // initialize signature.
         super();
         this.nodeName = name;
         this.nodeType = LzDataElement.ELEMENT_NODE;
-        this.attributes = attributes;
         this.ownerDocument = this;
-        this.$lzc$set_childNodes( children );
+        if (attributes) {
+            this.$lzc$set_attributes(attributes);
+        } else {
+            this.attributes = {};
+        }
+        if (children) {
+            this.$lzc$set_childNodes(children);
+        } else {
+            this.childNodes = [];
+            this.__LZcoDirty = false;
+        }
     }
 
 /**
@@ -720,7 +731,7 @@
   * @param String name: the name for each node
   * @return Array: list of new nodes.
   */
-static function makeNodeList(count:int, name:String) :Array {
+static function makeNodeList (count:int, name:String) :Array {
     var a:Array = [];
     for (var i:int = 0; i < count; i++) {
         a[i] = new LzDataElement(name, {}, null);
@@ -731,7 +742,7 @@
 /**
   * Get LzDataElement representation of primitive type, array, or object value.
   */
-static function valueToElement ( o:* ) :LzDataElement {
+static function valueToElement (o:*) :LzDataElement {
     return new LzDataElement("element", {}, LzDataElement.__LZv2E(o));
 }
 
@@ -740,27 +751,21 @@
   * @return array of LzDataElements
   * @access private
   */
-static function __LZv2E ( o:* ) :Array {
-
-    var type:String = typeof( o );
-
+static function __LZv2E (o:*) :Array {
     var c:Array = [];
-    if (type == "object") {
+    if (typeof( o ) == "object") {
         if ( o is LzDataElement ||
              o is LzDataText ) {
             c[0] = o;
         } else if (o is Date) {
-            type = "date";
             // FIXME: [2004-04-10 pkang] what should we do with dates?
         } else if (o is Array) {
-            type = "array";
             var tag:String = (o.__LZtag != null ? o.__LZtag : 'item');
             for (var i:int = 0; i < o.length; i++) {
                 var tmpC:Array = LzDataElement.__LZv2E( o[i] );
                 c[i] = new LzDataElement(tag, null, tmpC ); 
             }
         } else {
-            type = "struct";
             var i:int = 0;
             for (var k:String in o) {
                 // skip any properties that start with __LZ
@@ -772,9 +777,7 @@
         c[0] = new LzDataText( o );
     }
 
-    if (c.length == 0) c = null;
-
-    return c;
+    return (c.length != 0 ? c : null);
 }
 
 
@@ -808,16 +811,16 @@
 /**
   * @access private
   */
-static function __LZXMLescape ( t:* ) :* {
-    if ( typeof( t ) != "string" ) return t;
+static function __LZXMLescape (t:*) :* {
+    if (typeof( t ) != "string") return t;
 
     const escChars:Object = LzDataElement.__LZescapechars;
     var olen:int = t.length;
     var r:String = "";
-    for ( var i:int = 0; i < olen; i++ ){
+    for (var i:int = 0; i < olen; i++) {
         //handle newlines
         var code:Number = t.charCodeAt( i );
-        if ( code < 32 ){
+        if (code < 32) {
             r += "&#x" + code.toString(16) + ";";
         } else {
             var c:String = t.charAt( i );
@@ -840,7 +843,7 @@
   * @return LzDataElement: An LzDataElement which is the top of the hierarchy
   * generated from the string
   */
-static function stringToLzData( str:String, trimwhitespace:Boolean=false, nsprefix:Boolean=false ) :LzDataElement {
+static function stringToLzData (str:String, trimwhitespace:Boolean = false, nsprefix:Boolean = false) :LzDataElement {
     if (str != null && str != "") {
         try {
             var nativexml:* = LzXMLParser.parseXML(str, trimwhitespace, nsprefix);
@@ -867,7 +870,7 @@
   * trim whitespace from start and end of string
   * @access private
   */
-static function trim( str:String ) :String {
+static function trim (str:String) :String {
     var whitech:Object = LzDataElement.whitespaceChars;
     var len:int = str.length;
     var sindex:int = 0;

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataNode.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataNode.lzs	2009-04-15 18:15:04 UTC (rev 13687)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataNode.lzs	2009-04-15 18:20:53 UTC (rev 13688)
@@ -62,6 +62,8 @@
   * don't set it here!
   *
   * @devnote W3C-DOM Node interface: http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-1950641247
+  *
+  * @devnote uncomment typing when LPP-5840 is implemented
   */
 mixin LzDataNodeMixin {
 /** @lzxtype event */
@@ -144,7 +146,7 @@
   * @return int
   */
 public function getOffset () :int {
-    if (!this.parentNode) return 0;
+    if (! this.parentNode) return 0;
     if (this.parentNode.__LZcoDirty) this.parentNode.__LZupdateCO();
 
     return this.__LZo;
@@ -155,13 +157,13 @@
   * @return LzDataNodeMixin: The node immediately preceeding this node
   */
 public function getPreviousSibling () /*:LzDataNodeMixin*/ {
-    if (!this.parentNode) return null;
-    if ( this.parentNode.__LZcoDirty ) this.parentNode.__LZupdateCO();
+    if (! this.parentNode) return null;
+    if (this.parentNode.__LZcoDirty) this.parentNode.__LZupdateCO();
     return this.parentNode.childNodes[ this.__LZo - 1 ];
 }
 
 /** @access private */
-function $lzc$getPreviousSibling_dependencies( who, self ) :Array {
+function $lzc$getPreviousSibling_dependencies (who:*, self:*) :Array {
     return [ this.parentNode , "childNodes" , this , "parentNode" ];
 }
 
@@ -170,13 +172,13 @@
   * @return LzDataNodeMixin: The node immediately succeeding this node
   */
 public function getNextSibling () /*:LzDataNodeMixin*/ {
-    if (!this.parentNode) return null;
-    if ( this.parentNode.__LZcoDirty ) this.parentNode.__LZupdateCO();
+    if (! this.parentNode) return null;
+    if (this.parentNode.__LZcoDirty) this.parentNode.__LZupdateCO();
     return this.parentNode.childNodes[ this.__LZo + 1 ];
 }
 
 /** @access private */
-function $lzc$getNextSibling_dependencies( who, self ) :Array {
+function $lzc$getNextSibling_dependencies (who:*, self:*) :Array {
     return [ this.parentNode , "childNodes" , this , "parentNode" ];
 }
 
@@ -184,10 +186,10 @@
   * Renamed from childOf to avoid conflict with LzNode.childOf.
   * childOf still exists because it is part of the public API.
   */
-function childOfNode ( el, allowself:Boolean = false ) :Boolean {
-    var p = allowself ? this : this.parentNode
-    while ( p ){
-        if ( p == el ) return true;
+function childOfNode (el/*:LzDataNodeMixin*/, allowself:Boolean = false) :Boolean {
+    var p /*:LzDataNodeMixin*/ = allowself ? this : this.parentNode;
+    while (p) {
+        if (p === el) return true;
         p = p.parentNode;
     }
     return false;
@@ -200,7 +202,7 @@
   * @param Boolean allowself: If true, this function returns true if the given
   * node is the same as this node.
   */
-override function childOf ( el, allowself=false ) {
+override function childOf (el, allowself = false) {
   return this.childOfNode(el, allowself);
 }
 
@@ -235,7 +237,7 @@
   * new node
   * @return LzDataNodeMixin: A copy of this node.
   */
-public function cloneNode ( deep:Boolean = false ) :LzDataNodeMixin {
+public function cloneNode (deep:Boolean = false) :LzDataNodeMixin {
     /* not implemented here */
     return undefined;
 }
@@ -244,7 +246,7 @@
   * Returns this node as a string of xml.
   * @return String: The string serialization of this node.
   */
-public function serialize (len:Number = Infinity) :String {
+public function serialize () :String {
     /* not implemented here */
     return undefined;
 }
@@ -341,9 +343,9 @@
   * generated from the string
   * @deprecated Use <code>LzDataElement.stringToLzData</code> 
   */
-static function stringToLzData( str:String, trimwhitespace:Boolean = false, nsprefix:Boolean = false ) :LzDataElement {
-    if ( $debug ){
-        Debug.info("LzDataNode.stringToLzData is deprecated.  Use `LzDataElement.stringToLzData` instead.");
+static function stringToLzData (str:String, trimwhitespace:Boolean = false, nsprefix:Boolean = false) :LzDataElement {
+    if ($debug) {
+        Debug.info("lz.DataNode.stringToLzData is deprecated.  Use `lz.DataElement.stringToLzData` instead.");
     }
     return LzDataElement.stringToLzData(str, trimwhitespace, nsprefix);
 
@@ -356,7 +358,7 @@
  * @access private
  */
 function toString () /*:String*/ { 
-    return "LzDataNode";
+    return "lz.DataNode";
 }
 
 } // End of LzDataNode

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataText.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataText.lzs	2009-04-15 18:15:04 UTC (rev 13687)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataText.lzs	2009-04-15 18:20:53 UTC (rev 13688)
@@ -18,6 +18,8 @@
   * @see lzdatanodemixin, lzdataelement, datapointer
   *
   * @devnote W3C-DOM Text interface: http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-1312295772
+  *
+  * @devnote uncomment typing when LPP-5840 is implemented
   */
 class LzDataText extends LzDataNode with LzDataNodeMixin {
 
@@ -25,7 +27,7 @@
  * This object represents a text node in a set of data.
  * @param String text: The text that this node holds.
  */
-function LzDataText ( text:String ){
+function LzDataText (text:String) {
     super();
     this.nodeType = LzDataElement.TEXT_NODE;
     this.data = text;
@@ -55,7 +57,7 @@
 var data :String = "";
 
 /** @access private */
-function $lzc$set_data(newdata:String) :void {
+function $lzc$set_data (newdata:String) :void {
     this.data = newdata;
     if (this.ondata.ready) {
         this.ondata.sendEvent( newdata );
@@ -65,18 +67,12 @@
     }
 }
 
-
-/** @type Number
-  * @keywords read-only 
-  */
-var length :Number = 0;
-
 /**
   * Sets the string that this node holds.
   * @param String newdata: The new string for this node.
   * @deprecated Use setAttribute('data', ...) instead.
   */
-public function setData ( newdata:String ) {
+public function setData (newdata:String) {
     if ($debug) Debug.deprecated(this, arguments.callee, this.setAttribute);
     this.$lzc$set_data(newdata);
 }
@@ -84,14 +80,14 @@
 /**
   * @access private
   */
-override public function cloneNode ( deep:Boolean = false ) :LzDataNodeMixin {
+override public function cloneNode (deep:Boolean = false) :LzDataNodeMixin {
     return new LzDataText(this.data);
 }
 
 /**
   * @access private
   */
-override public function serialize (len:Number = Infinity) :String {
+override public function serialize () :String {
     return LzDataElement.__LZXMLescape( this.data );
 }
 

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataset.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataset.lzs	2009-04-15 18:15:04 UTC (rev 13687)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataset.lzs	2009-04-15 18:20:53 UTC (rev 13688)
@@ -390,6 +390,8 @@
 override function construct (parent, args) {
     this.nodeType = LzDataElement.DOCUMENT_NODE;
     this.ownerDocument = this;
+    this.attributes = {};
+    this.childNodes = [];
 
     this.queuerequests = false; // default to false, to emulate browser default
 
@@ -412,7 +414,7 @@
         this.dataprovider = canvas.defaultdataprovider;
     }
 
-    super.construct.apply(this, arguments);
+    super.construct(parent, args);
 }
 
 /**
@@ -420,7 +422,7 @@
   * @access private
   */
 override function $lzc$set_name(name:String) {
-    super.$lzc$set_name.apply(this, arguments);
+    super.$lzc$set_name(name);
 
     // @devnote: Name is permitted to be null or undefined, meaning
     // "don't name me", see LzNode#$lzc$set_name(..).



More information about the Laszlo-checkins mailing list