Hi.

I think I have found a bug in the code for the "append" method of the 
"qx.data.Array" class in the framework 3.0.0.

This issue show up if you use a qx.data.Array instance as a model of a 
qx.ui.mobile.list.List widget with objects that supports event bubbling, as
objects that use qx.data.marshal.MEventBubbling mixin.

The "append" method says:

    append : function(array)
    {
      // qooxdoo array support
      if (array instanceof qx.data.Array) {
        array = array.toArray();
      }

      // this check is important because opera throws an uncatchable error
if
      // apply is called without an array as argument.
      if (qx.core.Environment.get("qx.debug")) {
        qx.core.Assert.assertArray(array, "The parameter must be an
array.");
      }

      Array.prototype.push.apply(this.__array, array);

      // add a listener to the new items
      for (var i = 0; i < array.length; i++) {
        this._registerEventChaining(array[i], null, this.__array.length +
i);
      }

      [....] // other code here


The problem is in the call of the _registerEventChaining method. The name of
the property, "this.__array.length + i", must represent the index of the new
items but the new items have already been appended to the "__array" array so
the index "this.__array.length + i" is out of range.

You can see the bug here in the playground:

http://tinyurl.com/p4hr66j

The configureItem method of the provider object for the
qx.ui.mobile.list.List 
gets an undefined "data" parameter because I removed and appended the data
in the model (starts at line 53). You can see this because I called
"setTitle" on
an object activating the event bubbling mechanism when you click on the 
Button.

If you comment the lines 55-58 all works correctly.

I hope I made myself clear because it was really difficult to debug the 
issue.

Thanks for this worderful framework! It's really a good job and a pleasure 
to work with.

Leonardo



--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/qx-data-Array-append-and-event-bubbling-possible-bug-tp7584269.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to