[Laszlo-checkins] r13691 - openlaszlo/trunk/WEB-INF/lps/lfc/data
bargull@openlaszlo.org
bargull at openlaszlo.org
Wed Apr 15 14:35:59 PDT 2009
Author: bargull
Date: 2009-04-15 14:35:56 -0700 (Wed, 15 Apr 2009)
New Revision: 13691
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs
Log:
Change 20090415-bargull-UJC by bargull at dell--p4--2-53 on 2009-04-15 22:26:03
in /home/Admin/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: fix offset bug in insertBefore and replaceChild
New Features:
Bugs Fixed: LPP-8037 (insertBefore ordering bug)
Technical Reviewer: hminsky
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
After calling __LZremoveChild() in insertBefore() resp. replaceChild(), the offset may need to be adjusted to compensate the splice operation on the childNodes array. Also set __LZcoDirty to true after removing child in __LZremoveChild().
Tests:
testcases from bugreport
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs 2009-04-15 20:52:22 UTC (rev 13690)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs 2009-04-15 21:35:56 UTC (rev 13691)
@@ -58,7 +58,11 @@
if (newChild.parentNode != null) {
if (newChild.parentNode === this) {
if (! samenode) {
- this.__LZremoveChild( newChild );
+ var nchildoff:int = this.__LZremoveChild( newChild );
+ if (nchildoff != -1 && nchildoff < off) {
+ // removeChild shifted children, need to adjust offset
+ off -= 1;
+ }
}
} else {
newChild.parentNode.removeChild( newChild );
@@ -105,7 +109,11 @@
if (newChild.parentNode != null) {
if (newChild.parentNode === this) {
if (! samenode) {
- this.__LZremoveChild( newChild );
+ var nchildoff:int = this.__LZremoveChild( newChild );
+ if (nchildoff != -1 && nchildoff < off) {
+ // removeChild shifted children, need to adjust offset
+ off -= 1;
+ }
}
} else {
newChild.parentNode.removeChild( newChild );
@@ -178,7 +186,6 @@
} */ else {
if (newChild.parentNode != null) {
if (newChild.parentNode === this) {
- this.__LZcoDirty = true;
this.__LZremoveChild( newChild );
} else {
newChild.parentNode.removeChild( newChild );
@@ -346,12 +353,15 @@
* - setting parentNode to null
* - setting ownerDocument to null
* @access private
+ * @return index of the removed child, -1 if child not found
*/
-function __LZremoveChild (oldChild /*:LzDataNodeMixin*/) :void {
+function __LZremoveChild (oldChild /*:LzDataNodeMixin*/) :int {
var off:int = this.__LZgetCO(oldChild);
if (off >= 0) {
+ this.__LZcoDirty = true;
this.childNodes.splice(off, 1);
}
+ return off;
}
/**
More information about the Laszlo-checkins
mailing list