Make WordPress Core

Opened 12 years ago

Closed 11 years ago

#3343 closed defect (bug) (fixed)

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

Reported by: dan-daemon Owned by: mdawaffe
Milestone: 2.1 Priority: normal
Severity: normal Version: 2.1
Component: Administration Keywords: has-patch needs-testing
Focuses: 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

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 (3)

3343.diff (14.0 KB) - added by mdawaffe 11 years ago.
3343b.diff (14.0 KB) - added by mdawaffe 11 years ago.
3343c.diff (14.0 KB) - added by mdawaffe 11 years ago.

Download all attachments as: .zip

Change History (10)

#1 @dan-daemon
12 years ago

  • Milestone set to 2.1
  • Version set to 2.1

#2 @foolswisdom
12 years ago

  • Description modified (diff)
  • 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

#3 @mdawaffe
11 years ago

  • 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();


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

11 years ago

#4 @mdawaffe
11 years ago

  • Keywords has-patch needs-testing added

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.

11 years ago

#5 @mdawaffe
11 years ago


  1. First patch had a typo.

11 years ago

#6 @mdawaffe
11 years ago


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

#7 @ryan
11 years ago

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

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

Note: See TracTickets for help on using tickets.