Bug Tracker

Modify

Ticket #6484 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

data attribute overwrited in new node creation

Reported by: naugtur Owned by: naugtur
Priority: undecided Milestone: 1.4.3
Component: data Version: 1.4.2
Keywords: Cc:
Blocking: Blocked by:

Description

found here:  http://stackoverflow.com/questions/2713542/bug-in-jquerys-element-creation

$(document).ready(function(){

var fun=function(){

alert('fired');

};

var parms={

'id': 'sth', 'text': 'click', 'click':fun, 'data': {

'somedata': 'somedata'

} };

var _new_li = $('<li/>',parms);

_new_li.appendTo($("body")); });

After clicking on the li element error is thrown

e is undefined in jquery line 1919

var events = jQuery.data(this, "events"), handlers = events[ event.type ];

events is undefined.

jquery overwrites events stored in data.

It probably should extend.

Change History

comment:1 Changed 3 years ago by rwaldron

  • Owner set to naugtur
  • Priority set to undecided
  • Status changed from new to pending

Please provide a reduced jsFiddle test case, thanks!

Additionally, test against the jQuery 0 GIT version to ensure the issue still exists.

comment:2 Changed 3 years ago by rwaldron

  • Keywords needsreview added; creation data overwrite removed

comment:3 Changed 3 years ago by dmethvin

  • Status changed from pending to closed
  • Resolution set to fixed

comment:4 Changed 3 years ago by dmethvin

  • Keywords needsreview removed

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.