[jQuery] IE function() bug when using clone()
Maybe I'm missing something but I seem to have found a problem with assigning
a function to a new object created with clone(). But oddly enough it only
seems to happen in certain cases related to the assignment of the this
element.
There is an example at: http://aos.elicochran.com/
Example works fine in Firefox (on Mac and Windows), Safari, but on IE 6&7
instead of dimming the source row, the row is deleted.
The offending code is:
function addRowElement(row_obj) {
if ( $(row_obj).attr('class') != "dim" ) {
var newRow = $(row_obj).clone(true);
$(newRow).attr('name',$(row_obj).attr('id'));
$(newRow).attr('id','');
$(newRow).click( function() {
removeRowElement(this) ;
return false;
});
if ( $('#placeholder') ) $('#placeholder').remove() ;
$(newRow).appendTo('#bucket');
$(row_obj).addClass("dim");
}
scrollBottom();
setCounter();
}
Oddly enough when the same code is called from this loop, it works fine.
(Try the Add All button in the example.)
function addAllRows() {
$('#fruit_list tr').each(function(count) {
addRowElement(this);
});
}
--
View this message in context: http://www.nabble.com/IE-function%28%29-bug-when-using-clone%28%29-tf3137347.html#a8694369
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/