Bug Tracker

Opened 9 years ago

Closed 9 years ago

#7028 closed bug (duplicate)

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.

Change History (1)

comment:1 Changed 9 years ago by dmethvin

Priority: undecided
Resolution: duplicate
Status: newclosed

Dup of #6355.

Note: See TracTickets for help on using tickets.