Skip to main content

Bug Tracker

Side navigation

#7028 closed bug (duplicate)

Opened September 13, 2010 05:12PM UTC

Closed September 30, 2010 12:36AM UTC

Data and event handling breaks with derivation from Array type

Reported by: mathbr Owned by:
Priority: undecided Milestone: 1.4.3
Component: unfiled Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:
Description

If one tries to derive from the base type "Array", neither data nor event handling work anymore. See the following example:

function Model() {
    this.push = function(item) {
        Model.prototype.push.call(this, item);
        $(this).trigger('added', [item]);
    };
};
Model.prototype = new Array;

var m = new Model();
$(m).data('test', 'TEST');
alert($(m).data('test'));

$(m).bind({
    'added': function(event, item) {
        alert('Item added: ' + item);
    }
});

m.push(42);

The value of the "test" data is suddenly undefined, the event "myEvent" is never fired.

Attachments (0)
Change History (1)

Changed September 30, 2010 12:36AM UTC by dmethvin comment:1

priority: → undecided
resolution: → duplicate
status: newclosed

Dup of #6355.