Ticket #3343 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Delete categories JavaScript error: Object doesn't support this property or method.

Reported by: dan-daemon Assigned to: mdawaffe
Priority: normal Milestone: 2.1
Component: Administration Version: 2.1
Severity: normal Keywords: has-patch needs-testing
Cc:

Description (Last modified by foolswisdom)

When I delete category, software initiates ajax request to the server, then delete item from the table by ajax response, correct? If so, after it I get JavaScript? error: Object doesn't support this property or method.

I use IE7 and thought that this bug in JavaScript? with new IE release, then I checked it to Firefox and got this JavaScript? error after deleting category (copied from JavaScript? console):

$(id) has no properties
http://my.domain.com/wp-includes/js/list-manipulation-js.php?ver=4187

Also, as I can see sometimes when I receive this error I also get this alert box (mostly Firefox):

Are you sure you want to navigate away from this page?
Slow down, I'm still sending your data[[br]] Press OK to continue, or Cancel to stay on the current page.

This bug presents in IE all time, but in firefox only for first deleted item. Then I do not see any errors, deleting goes well.

Attachments

3343.diff (14.0 kB) - added by mdawaffe on 01/19/07 00:00:41.
3343b.diff (14.0 kB) - added by mdawaffe on 01/19/07 00:14:15.
3343c.diff (14.0 kB) - added by mdawaffe on 01/19/07 00:33:56.

Change History

11/08/06 22:16:16 changed by dan-daemon

  • version set to 2.1.
  • milestone set to 2.1.

11/23/06 00:36:01 changed by foolswisdom

  • description changed.
  • summary changed from Add/Delete categories bug in last trunks to Delete categories JavaScript error: Object doesn't support this property or method..

Reproduced bug on delete of cat with IE 7

Hi Dan-daemon, thank you for reporting this problem. In the future please include the details right in the ticket.

ENV: WP trunk r4515

WinXP / IE 7

* Could not reproduce on Linux / Firefox 2.0 - Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20060601 Firefox/2.0 (Ubuntu-edgy)

Description was:
Hello guys,

Can you give me solution for bugs I described here: http://wordpress.org/support/topic/93417?replies=2

Thanks, Dan

01/18/07 23:57:46 changed by mdawaffe

  • owner changed from anonymous to mdawaffe.
  • status changed from new to assigned.

I believe this is because most of WP's JS tries to use prototype's Element.x functions as extensions to the native JS element object like good little object oriented scripts.

But those extensions aren't reliable in all browsers. It's better to use Element.hide($('element_id'));, for example, than $('element_id').hide();

Patch

  1. Converts all WP core JS to use Element.method(el) rather than el.method();
  2. Fixes wp-ajax JS parser for IE 7.

01/19/07 00:00:41 changed by mdawaffe

  • attachment 3343.diff added.

01/19/07 00:01:48 changed by mdawaffe

  • keywords set to has-patch needs-testing.

I testing this and it all seems to work, but I'd appreciate other people trying it out in other browsers.

I was not able to test the changes to the cropper.

01/19/07 00:14:15 changed by mdawaffe

  • attachment 3343b.diff added.

01/19/07 00:14:38 changed by mdawaffe

3343b.diff

  1. First patch had a typo.

01/19/07 00:33:56 changed by mdawaffe

  • attachment 3343c.diff added.

01/19/07 00:34:39 changed by mdawaffe

3343c.diff

I think this is a better fix for WP's ajax response parser.

01/19/07 00:49:05 changed by ryan

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [4768]) Category AJAX fixes from mdawaffe. fixes #3343