[jQuery] Wordpress using jQuery problem
Hello,
i noticed on IE6 that some widgets disappear when clicking the "edit"
link of some widgets like the RSS and Text widgets.
Now, i am not seeking support for wordpress it's self but after i
traced the code:
var addWidgetControls = function( context ) {
if ( !context )
context = document;
$('a.widget-control-edit', context).click( editClick );
// onclick for save links
$('a.widget-control-save', context).click( function() {
EndTime = new Date();
var diff = EndTime.getTime() - StartTime.getTime();
alert(diff);
toggleWidget( $(this).parents('li:first'), false ).blur()
return false;
} );
// onclick for remove links
$('a.widget-control-remove', context).click( function() {
var w = $(this).parents('li:first').find('input
[@name^="widget-id"]').val();
$(this).parents('li:first').remove();
var t = $('#widget-list ul#widget-control-info-' + w + '
textarea');
t.parent().html( t.text() ).parents('li.widget-list-
item:first').children( 'h4' ).children('a.widget-action')
.show().text( widgetsL10n.add ).unbind().click
( addClick );
var n = parseInt( $('#widget-count').text(), 10 ) - 1;
$('#widget-count').text( n.toString() )
return false;
} );
}
the edit event is called, and then the "save" and "remove" are
executed after the edit code finishes execution immediately which
results in the disappearance of the widget. Can someone comment on
this part and help me get some idea about why this is happening?
on this post on wordpress's Trac a member commented as follows:
[COMMENT]
This is in general true for all multiwidgets (RSS, Categories...).
I have no idea what's going on here. I can tell you what's happening,
but not why.
When you click the "Edit" link, the edit.click action is fired (good),
then the save.click action is fired (bad), then the remove.click
action is fired (bad).
Internet explorer is applying the click bindings on source:/trunk/wp-
admin/js/widgets.js@7628#L98 and source:/trunk/wp-admin/js/
widgets.js@7628#L104 to a.widget-control-edit rather than a.widget-
control-save and a.widget-control-remove, respectively.
[/COMMENT]